From 63eca0f54232eff6440ed0608ec22d8c91871017 Mon Sep 17 00:00:00 2001 From: Keyna Rafael <95432445+keyn4@users.noreply.github.com> Date: Fri, 2 Feb 2024 15:46:58 -0500 Subject: [PATCH] handle not json responses (#95) --- tap_quickbooks/quickbooks/rest.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/tap_quickbooks/quickbooks/rest.py b/tap_quickbooks/quickbooks/rest.py index 582f9f7..4d50545 100644 --- a/tap_quickbooks/quickbooks/rest.py +++ b/tap_quickbooks/quickbooks/rest.py @@ -63,16 +63,17 @@ def _query_recur( yield record except HTTPError as ex: - response = ex.response.json() - if isinstance(response, list) and response[0].get("errorCode") == "QUERY_TIMEOUT": - start_date = singer_utils.strptime_with_tz(start_date_str) - day_range = (end_date - start_date).days - LOGGER.info( - "Quickbooks returned QUERY_TIMEOUT querying %d days of %s", - day_range, - catalog_entry['stream']) - retryable = True - else: + try: + response = ex.response.json() + if isinstance(response, list) and response[0].get("errorCode") == "QUERY_TIMEOUT": + start_date = singer_utils.strptime_with_tz(start_date_str) + day_range = (end_date - start_date).days + LOGGER.info( + "Quickbooks returned QUERY_TIMEOUT querying %d days of %s", + day_range, + catalog_entry['stream']) + retryable = True + except: raise ex if retryable: