31
31
POSIT_LOCAL_CLIENT_CREDENTIALS_AUTH_TYPE = "posit-local-client-credentials"
32
32
POSIT_WORKBENCH_AUTH_TYPE = "posit-workbench"
33
33
34
+ logger = logging .getLogger ("posit.sdk" )
34
35
35
36
def _new_bearer_authorization_header (credentials : Credentials ) -> Dict [str , str ]:
36
37
"""Helper to transform an Credentials object into the Bearer auth header consumed by databricks.
@@ -119,8 +120,8 @@ def __init__(
119
120
self ._client = client
120
121
self ._user_session_token = user_session_token
121
122
if self ._user_session_token is None :
122
- logging .info (
123
- "ConnectStrategy will attempt to use OAuth Service Account credentials because user_session_token is not set. "
123
+ logger .info (
124
+ "ConnectStrategy will attempt to use OAuth Service Account credentials because user_session_token is not set"
124
125
)
125
126
126
127
def auth_type (self ) -> str :
@@ -129,7 +130,7 @@ def auth_type(self) -> str:
129
130
def __call__ (self , * args , ** kwargs ) -> CredentialsProvider : # noqa: ARG002
130
131
if not is_connect ():
131
132
raise ValueError (
132
- "The ConnectStrategy is not supported for content running outside of Posit Connect. "
133
+ "ConnectStrategy is not supported for content running outside of Posit Connect"
133
134
)
134
135
135
136
if self ._client is None :
@@ -172,24 +173,24 @@ def new_config(
172
173
del kwargs ["credentials_strategy" ]
173
174
174
175
if is_connect ():
175
- logging .info (
176
- "Initializing ConnectStrategy because the content appears to be running on Posit Connect. "
176
+ logger .info (
177
+ "Initializing ConnectStrategy because the content appears to be running on Posit Connect"
177
178
)
178
179
if posit_connect_strategy is not None :
179
180
credentials_strategy = posit_connect_strategy
180
181
else :
181
182
credentials_strategy = ConnectStrategy ()
182
183
elif is_workbench ():
183
- logging .info (
184
- "Initializing WorkbenchStrategy because the content appears to be running on Posit Workbench. "
184
+ logger .info (
185
+ "Initializing WorkbenchStrategy because the content appears to be running on Posit Workbench"
185
186
)
186
187
if posit_workbench_strategy is not None :
187
188
credentials_strategy = posit_workbench_strategy
188
189
else :
189
190
credentials_strategy = WorkbenchStrategy ()
190
191
else :
191
- logging .info (
192
- "Initializing default strategy because neither Posit Connect nor Posit Workbench were detected. "
192
+ logger .info (
193
+ "Initializing default strategy because neither Posit Connect nor Posit Workbench were detected"
193
194
)
194
195
if posit_default_strategy is not None :
195
196
credentials_strategy = posit_default_strategy
0 commit comments