File tree Expand file tree Collapse file tree 1 file changed +18
-6
lines changed
airbyte_cdk/sources/streams/http/requests_native_auth Expand file tree Collapse file tree 1 file changed +18
-6
lines changed Original file line number Diff line number Diff line change @@ -217,18 +217,30 @@ def _make_handled_request(self) -> Any:
217217 data = self .build_refresh_request_body (),
218218 headers = self .build_refresh_request_headers (),
219219 )
220- response_json = response .json ()
220+
221+ try :
222+ response_json = response .json ()
223+ except Exception as e :
224+ # if the json could not be parsed, save the exception to raise it later
225+ json_exception = e
226+
221227 try :
222- # extract the access token and add to secrets to avoid logging the raw value
223- access_key = self ._extract_access_token (response_json )
224- if access_key :
225- add_to_secrets (access_key )
228+ if response_json :
229+ # extract the access token and add to secrets to avoid logging the raw value
230+ access_key = self ._extract_access_token (response_json )
231+ if access_key :
232+ add_to_secrets (access_key )
226233 except ResponseKeysMaxRecurtionReached as e :
227- ## Could not find the access token in the response, so do nothing
234+ ## could not find the access token in the response, so do nothing
228235 pass
236+
229237 # log the response even if the request failed for troubleshooting purposes
230238 self ._log_response (response )
231239 response .raise_for_status ()
240+
241+ if json_exception :
242+ raise json_exception
243+
232244 return response_json
233245 except requests .exceptions .RequestException as e :
234246 if e .response is not None :
You can’t perform that action at this time.
0 commit comments