Skip to main content

Easy to use retryable requests sessions.

Project description

retryable-requests

PyPI

Easy to use retryable requests sessions.

Quickstart

Common case

from retryable_requests import RetryableSession

session = RetryableSession()
session.get('https://httpbin.org/get')  # will be retried up to 5 times

Only retry on 429 errors

from requests.packages.urllib3.util.retry import Retry
from retryable_requests import RetryableSession

retry_strategy = Retry(
    total=5,
    status_forcelist=[429],
    backoff_factor=0.1,
)

session = RetryableSession(retry_strategy=retry_strategy)
session.get('https://httpbin.org/get')  # will be retried up to 5 times, only for 429 errors

Automatically use a base URL for every request

from retryable_requests import RetryableBaseUrlSession

session = RetryableBaseUrlSession('https://httpbin.org/')
session.get('get')  # 'https://httpbin.org/get' will be retried up to 5 times
session.post('post')  # 'https://httpbin.org/post' won't be retried (POST request)

Features

  • Automatic backing off retries for failed requests that can be safely retried
  • Quick timeouts for non-responsive requests
  • BaseUrl compatible version of a RetryableSession

See also

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

retryable-requests-0.0.5.tar.gz (9.9 kB view details)

Uploaded Source

Built Distribution

retryable_requests-0.0.5-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

Details for the file retryable-requests-0.0.5.tar.gz.

File metadata

  • Download URL: retryable-requests-0.0.5.tar.gz
  • Upload date:
  • Size: 9.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.6

File hashes

Hashes for retryable-requests-0.0.5.tar.gz
Algorithm Hash digest
SHA256 eca85cae56b8498f572befe079b3481afd5e6fc4e8e95545283b3ba0415626f9
MD5 2345be3a5e772126166eb26bea075147
BLAKE2b-256 292b756443ee0293bfadb965362469d8a74f285b62f1fa9cb15ddbc677bee65b

See more details on using hashes here.

File details

Details for the file retryable_requests-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: retryable_requests-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 7.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.6

File hashes

Hashes for retryable_requests-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 46589f5d0ff694748ea4332a3c50a49707594684af9ac4921460645d9b659bf5
MD5 86aea5dfb56e0c77d30abe31a58183af
BLAKE2b-256 f601f2ecb406b3e4972e336df70b3898595a32db4eb0e80bafbb269288abc7ae

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page