spoqa-requests-backoff
Backoff session for requests
Usage
resp = BackoffSession().get('https://...')
By default, BackoffSession tries before giving up until any following condition is met:
- Tries 10 times
- Reaches 20 seconds
- Meets
requests.RequestException - Meets HTTP client error (4xx)
Behaviors above can be customized with parameters.
BackoffSession(
exception=(RequestException, ValueError), # Give up when ValueError occurs, too.
max_tries=100, # Tries 100 times before giving up
max_time=300, # Wait until maximum 300 seconds before giving up
giveup=lambda e: e.response.text == 'You're fired!' # Give up when specific response is met
)
BackoffSession heavily depends on backoff package.
License
spoqa-requests-backoff is distributed under the terms of MIT License.
See LICENSE for more details.
Metadata
Release files for spoqa-requests-backoff 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| spoqa-requests-backoff-0.1.1.tar.gz | 3.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| spoqa_requests_backoff-0.1.1-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Total release size: 6.9 kB
Release files / spoqa-requests-backoff-0.1.1.tar.gz
| Download URL | spoqa-requests-backoff-0.1.1.tar.gz |
|---|---|
| Size | 3.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
95b20685fd750929062f46cef649d6102cf334703901424520c85ce7044a37e6
|
|
BLAKE2b-256 checksum How to use checksums |
10eb99df77a805f2d84e5f990596ed4e2b7be1679646ca32d9b289657ed468db
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.5 CPython/3.9.2 Linux/5.10.20-1-lts
|
Release files / spoqa_requests_backoff-0.1.1-py2.py3-none-any.whl
| Download URL | spoqa_requests_backoff-0.1.1-py2.py3-none-any.whl |
|---|---|
| Size | 3.5 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
86f69fdd87af12b4aef8187783905cd74aae83dc1fa8a9531ecb16e9277fc4aa
|
|
BLAKE2b-256 checksum How to use checksums |
963e7a386675e2c4d22b84fdb21a2af5a16266c46217229b97a7748b16309df2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.5 CPython/3.9.2 Linux/5.10.20-1-lts
|