Skip to content

Commit

Permalink
Raise for status if retry-after is not in the headers
Browse files Browse the repository at this point in the history
  • Loading branch information
SmittieC committed Oct 24, 2023
1 parent 4e75422 commit 21108bf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions commcare_export/commcare_hq_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def get(self, resource, params=None):
@backoff.on_predicate(
backoff.runtime,
predicate=lambda r: r.status_code == 429,
value=lambda r: ceil(float(r.headers.get("Retry-After", 0.0))),
value=lambda r: ceil(float(r.headers.get("Retry-After", 1.0))),
jitter=None,
on_backoff=on_wait,
)
Expand All @@ -146,7 +146,7 @@ def _get(resource, params=None):
response = self.session.get(
resource_url, params=params, auth=self.__auth, timeout=60
)
if response.status_code != 429:
if "Retry-After" not in response.headers:
response.raise_for_status()
return response

Expand Down

0 comments on commit 21108bf

Please sign in to comment.