Skip to content

Commit

Permalink
fix backoff for 500 (#114)
Browse files Browse the repository at this point in the history
  • Loading branch information
keyn4 authored Sep 11, 2024
1 parent d5422c5 commit b11a7cb
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions tap_quickbooks/quickbooks/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,12 +385,9 @@ def _make_request(self, http_method, url, headers=None, body=None, stream=False,
resp = self.session.post(url, headers=headers, data=body)
else:
raise TapQuickbooksException("Unsupported HTTP method")

if (
resp.status_code == 500
and resp.text
== "Authorization FailureAuthorizationFailure: Unknown Error during Authentication, statusCode: 500"
) or resp.status_code in [400]:
if resp.status_code in [400, 500]:
if "Authorization Failure" in resp.text:
self.login()
raise RetriableApiError(resp.text)
try:
resp.raise_for_status()
Expand Down Expand Up @@ -426,6 +423,7 @@ def login(self):
self.access_token = auth['access_token']

new_refresh_token = auth['refresh_token']
LOGGER.info(F"REFRESH TOKEN: {new_refresh_token}")

# persist access_token
parser = argparse.ArgumentParser()
Expand Down

0 comments on commit b11a7cb

Please sign in to comment.