Backoff Session for requests
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for spoqa-requests-backoff-0.1.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 95b20685fd750929062f46cef649d6102cf334703901424520c85ce7044a37e6 |
|
MD5 | 52bd0776209dcd2121693d6d582ba0a3 |
|
BLAKE2b-256 | 10eb99df77a805f2d84e5f990596ed4e2b7be1679646ca32d9b289657ed468db |
Close
Hashes for spoqa_requests_backoff-0.1.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 86f69fdd87af12b4aef8187783905cd74aae83dc1fa8a9531ecb16e9277fc4aa |
|
MD5 | db06ff212638947502341741c9cc2f55 |
|
BLAKE2b-256 | 963e7a386675e2c4d22b84fdb21a2af5a16266c46217229b97a7748b16309df2 |