Skip to content

Commit

Permalink
Update session handler to retry on rate limit error
Browse files Browse the repository at this point in the history
  • Loading branch information
bsweger committed Aug 26, 2024
1 parent 22ce19d commit 56b1c71
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/reichlab_repo_utils/util/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ def get_session(token: str) -> requests.Session:
# https://urllib3.readthedocs.io/en/latest/reference/urllib3.util.html#urllib3.util.retry.Retry
retries = Retry(
total=5,
allowed_methods=frozenset(["GET", "POST"]),
allowed_methods=frozenset(["GET", "POST", "PATCH"]),
backoff_factor=1,
status_forcelist=[500, 502, 503, 504],
status_forcelist=[429, 500, 502, 503, 504],
)
session.mount("https://", HTTPAdapter(max_retries=retries))
session.headers.update(headers)
Expand Down

0 comments on commit 56b1c71

Please sign in to comment.