Skip to content

Commit

Permalink
handle 429s (#83)
Browse files Browse the repository at this point in the history
  • Loading branch information
keyn4 authored Dec 8, 2023
1 parent 772a609 commit f7ef39f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tap_quickbooks/quickbooks/rest_reports.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import backoff
import requests
import singer
import time

LOGGER = singer.get_logger()

Expand Down Expand Up @@ -43,6 +44,10 @@ def _get(self, report_entity: str, params: Optional[Dict] = None) -> Dict:
params.update({"minorversion": self.api_minor_version})

response = requests.get(url, headers=headers, params=params)
if response.status_code == 429:
# quickbooks: HTTP Status Code 429 happens when throttling occurs.
# Wait 60 seconds before retrying the request.
time.sleep(60)
response.raise_for_status()
return response.json()

Expand Down

0 comments on commit f7ef39f

Please sign in to comment.