Retry-requests
Configures the passed-in requests’ Session to retry on failed requests due to connection errors, timeouts, specific HTTP response codes (5XX by default) and 30X redirections —anything that could fail.
Python 3.6+.
Basic usage:
from retry_requests import retry
my_session = retry()
my_session.get("http://foo.bar")
This get will retry three times in case of error waiting some time between retries. Errors could be:
Waiting for the server to start answering for 5 seconds.
No access to the server or a dropped connection.
An HTTP answer of 500, 502, or 504.
You can change these defaults:
from retry_requests import retry
from requests import Session
my_session = retry(Session(), retries=5, backoff_factor=0.2)
my_session.get('https://foo.bar')
Check the function retry to know more about this configuration.
Note that you have a TSession, a Session with a default timeout, and RSession, a Session with a timeout that always raise_for_status(), for your convenience.
Heavily inspired from Peterbe.com. Thank you!
Installing
Just pip install retry-requests.
Testing
Clone this project and then, at its root directory, run python setup.py test. Note that you need an active Internet connection to run the tests.
Metadata
Release files for retry-requests 2.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| retry-requests-2.0.0.tar.gz | 16.1 kB | Without provenance | Details for retry-requests-2.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| retry_requests-2.0.0-py3-none-any.whl | Python 3 | none | any | Details for retry_requests-2.0.0-py3-none-any.whl |
Total release size: 31.9 kB
Release files / retry-requests-2.0.0.tar.gz
| Download URL | retry-requests-2.0.0.tar.gz |
|---|---|
| Size | 16.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3d02135e5aafedf09240414182fc7389c5d2b4de0252daba0054c9d6a27e7639
|
|
BLAKE2b-256 checksum How to use checksums |
1eda6e961557733660bef8d095a1d81423a3707486e2b2ecd2c5ad5ad8d2f59d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.3
|
Release files / retry_requests-2.0.0-py3-none-any.whl
| Download URL | retry_requests-2.0.0-py3-none-any.whl |
|---|---|
| Size | 15.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
38e8e3f55051e7b7915c1768884269097865a5da2ea87d5dcafd6ba9498c363f
|
|
BLAKE2b-256 checksum How to use checksums |
b1f38ce908497bebbc2790ef06240a2c0fb28c096abb59062d88f85090464a5f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.3
|
Security for retry-requests 2.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.