Skip to content

[Feature] Use requests included exponential backoff #2

Description

@TimidRobot

Problem

Use requests included exponential backoff configuration

Code Examples

fromrequests.adaptersimportHTTPAdapterfromrequests.packages.urllib3.util.retryimportRetry
# Requests configurationsmax_retries=Retry(
# try again after 5, 10, 20, 40, 80 seconds# for specified HTTP status codestotal=5,
backoff_factor=10,
status_forcelist=[403, 408, 429, 500, 502, 503, 504],
)
session=requests.Session()
session.mount("https://", HTTPAdapter(max_retries=max_retries))
withsession.get(
# ...
) asresponse:
response.raise_for_status()
search_data=response.json()
)

Additional context

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions