File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed
projects/vdk-plugins/vdk-oauth-auth/src/vdk/plugin/oauth Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -80,8 +80,12 @@ def vdk_initialize(self, context: CoreContext) -> None:
8080 # Scenario: data job running in local does not have oauth creds
8181 credentials_cache = LocalFolderCredentialsCache ()
8282 credentials = credentials_cache .read_credentials ()
83- credentials = json .loads (credentials .replace ("'" , '"' ))
84- self .access_token = credentials .get ("access_token" )
83+ try :
84+ creds_json = json .loads (credentials )
85+ except json .JSONDecodeError as e :
86+ log .error (f"Try VDK login command and then try executing data job." )
87+ raise e
88+ self .access_token = creds_json .get ("access_token" )
8589 self .control_service_rest_api_url = (
8690 oauth_configuration .control_service_rest_api_url ()
8791 )
@@ -114,10 +118,7 @@ def initialize_job(self, context: JobContext) -> None:
114118 # Retrieves details of an existing Data Job by specifying the name of the Data Job. | (Stable)
115119 oauth_creds = api_instance .oauth_credentials_get (self .team_name )
116120 except Exception as e :
117- print (
118- "Exception when calling DataJobsSecretsApi->oauth_credentials_get: %s\n "
119- % e
120- )
121+ log .error (f"Exception when fetching oauth credentials: { e } " )
121122 raise e
122123 oauth_creds = oauth_creds .to_dict ()
123124
You can’t perform that action at this time.
0 commit comments