File tree Expand file tree Collapse file tree 2 files changed +20
-8
lines changed Expand file tree Collapse file tree 2 files changed +20
-8
lines changed Original file line number Diff line number Diff line change @@ -360,7 +360,13 @@ def dq_template_config_cache(self) -> DQTemplateConfigCache:
360
360
return self ._dq_template_config_cache
361
361
362
362
@classmethod
363
- def from_token_guid (cls , guid : str ) -> AtlanClient :
363
+ def from_token_guid (
364
+ cls ,
365
+ guid : str ,
366
+ base_url : Optional [str ] = None ,
367
+ client_id : Optional [str ] = None ,
368
+ client_secret : Optional [str ] = None ,
369
+ ) -> AtlanClient :
364
370
"""
365
371
Create an AtlanClient instance using an API token GUID.
366
372
@@ -374,12 +380,14 @@ def from_token_guid(cls, guid: str) -> AtlanClient:
374
380
:returns: a new client instance authenticated with the resolved token
375
381
:raises: ErrorCode.UNABLE_TO_ESCALATE_WITH_PARAM: If any step in the token resolution fails
376
382
"""
377
- base_url = os .environ .get ("ATLAN_BASE_URL" , "INTERNAL" )
383
+ base_url = base_url or os .environ .get ("ATLAN_BASE_URL" , "INTERNAL" )
378
384
379
385
# Step 1: Initialize base client and get Atlan-Argo credentials
380
386
# Note: Using empty api_key as we're bootstrapping authentication
381
387
client = AtlanClient (base_url = base_url , api_key = "" )
382
- client_info = client .impersonate ._get_client_info ()
388
+ client_info = client .impersonate ._get_client_info (
389
+ client_id = client_id , client_secret = client_secret
390
+ )
383
391
384
392
# Prepare credentials for Atlan-Argo token request
385
393
argo_credentials = {
Original file line number Diff line number Diff line change @@ -66,12 +66,16 @@ def user(self, user_id: str) -> str:
66
66
except AtlanError as atlan_err :
67
67
raise ErrorCode .UNABLE_TO_IMPERSONATE .exception_with_parameters () from atlan_err
68
68
69
- def _get_client_info (self ) -> ClientInfo :
70
- client_id = os .getenv ("CLIENT_ID" )
71
- client_secret = os .getenv ("CLIENT_SECRET" )
72
- if not client_id or not client_secret :
69
+ def _get_client_info (
70
+ self , client_id : Optional [str ] = None , client_secret : Optional [str ] = None
71
+ ) -> ClientInfo :
72
+ final_client_id = client_id or os .getenv ("CLIENT_ID" )
73
+ final_client_secret = client_secret or os .getenv ("CLIENT_SECRET" )
74
+ if not final_client_id or not final_client_secret :
73
75
raise ErrorCode .MISSING_CREDENTIALS .exception_with_parameters ()
74
- client_info = ClientInfo (client_id = client_id , client_secret = client_secret )
76
+ client_info = ClientInfo (
77
+ client_id = final_client_id , client_secret = final_client_secret
78
+ )
75
79
return client_info
76
80
77
81
def escalate (self ) -> str :
You can’t perform that action at this time.
0 commit comments