Skip to main content

Middleware for implementing retry policies with HTTPX

Project description

RESPX

HTTPX Retry - Middleware for implementing retry policies with HTTPX


[!CAUTION] This project is no longer maintained as of 2025-04-23. Everyone should migrate to httpx-retries

Usage

Retries are defined at the transport layer.

import httpx

from httpx_retry import RetryTransport, RetryPolicy

exponential_retry = (
    RetryPolicy()
    .with_max_retries(3)
    .with_min_delay(0.1)
    .with_multiplier(2)
    .with_retry_on(lambda status_code: status_code >= 500)
)

client = httpx.Client(transport=RetryTransport(policy=exponential_retry))
res = client.get("https://example.com")

Examples

There are examples of implementing common retry policies in /tests

Installation

PyPI version PyPI - Python Version PyPI - Downloads

Available in PyPI

pip install httpx-retry

License

PyPI - License

See LICENSE for more info.

Contributing

Open Issues Stargazers

See CONTRIBUTING.md for info on PRs, issues, and feature requests.

Changelog

See CHANGELOG.md for summarized notes on changes or view releases for more details information on changes.

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

httpx_retry-2025.4.23.tar.gz (7.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

httpx_retry-2025.4.23-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

Details for the file httpx_retry-2025.4.23.tar.gz.

File metadata

  • Download URL: httpx_retry-2025.4.23.tar.gz
  • Upload date:
  • Size: 7.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.9 Darwin/24.3.0

File hashes

Hashes for httpx_retry-2025.4.23.tar.gz
Algorithm Hash digest
SHA256 83f7666c4844cb6e57107a55dac46f2a5418b6a0b79ca60e4d2aac313d0b74f9
MD5 6912219d7ae13a5636764b13e6f61463
BLAKE2b-256 061ae24ded244d89d304e40561ea7b48769ca43bd72f4b80aa124f785dfd4a08

See more details on using hashes here.

File details

Details for the file httpx_retry-2025.4.23-py3-none-any.whl.

File metadata

  • Download URL: httpx_retry-2025.4.23-py3-none-any.whl
  • Upload date:
  • Size: 7.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.9 Darwin/24.3.0

File hashes

Hashes for httpx_retry-2025.4.23-py3-none-any.whl
Algorithm Hash digest
SHA256 37cd2040f58d898d621f2bc570716681549d30c45a398f7a6f4935bf3ddbe295
MD5 2514a81676f7155d53e295a3983a1f54
BLAKE2b-256 8c58031ff7789fcbb2eee2284ef9dc9e94a416959acf6e1bef1af807dcf7a34b

See more details on using hashes here.

Supported by

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