Skip to content

Commit

Permalink
handle not json responses (#95)
Browse files Browse the repository at this point in the history
  • Loading branch information
keyn4 committed Feb 2, 2024
1 parent b36da08 commit 63eca0f
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions tap_quickbooks/quickbooks/rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 63eca0f

Please sign in to comment.