From b989faa62360374f45ff35236b90f8793ff7d0e6 Mon Sep 17 00:00:00 2001 From: Alexandros Milaios Date: Fri, 21 Jun 2024 10:31:24 +0300 Subject: [PATCH] fix: update giveup handler to check exc.response is not None and try all the error string --- .../connectors/source-hubspot/source_hubspot/streams.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/airbyte-integrations/connectors/source-hubspot/source_hubspot/streams.py b/airbyte-integrations/connectors/source-hubspot/source_hubspot/streams.py index 5b9c6584b06b..3c8fcc6dccb7 100644 --- a/airbyte-integrations/connectors/source-hubspot/source_hubspot/streams.py +++ b/airbyte-integrations/connectors/source-hubspot/source_hubspot/streams.py @@ -84,7 +84,9 @@ def giveup_handler(exc): return False if isinstance(exc, JSONDecodeError): return False - if TOKEN_REFRESH_RETRIES_EXCEEDED_ERROR.lower() in exc.response.text.lower(): + if exc.response is not None and TOKEN_REFRESH_RETRIES_EXCEEDED_ERROR.lower() in exc.response.text.lower(): + return False + if TOKEN_REFRESH_RETRIES_EXCEEDED_ERROR.lower() in str(exc): return False if isinstance(exc, (HubspotInvalidAuth, HubspotAccessDenied)): return True