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
- Adaptive Retry
- Circuit Breaker
- Exponential Backoff
- Fibonacci Backoff
- Fixed Delay
- Immediate Retry
- Jitter
- Linear Backoff
Installation
Available in PyPI
pip install httpx-retry
License
See LICENSE for more info.
Contributing
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.
Metadata
Release files for httpx-retry 2025.4.23
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| httpx_retry-2025.4.23.tar.gz | 7.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| httpx_retry-2025.4.23-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 14.8 kB
Release files / httpx_retry-2025.4.23.tar.gz
| Download URL | httpx_retry-2025.4.23.tar.gz |
|---|---|
| Size | 7.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
83f7666c4844cb6e57107a55dac46f2a5418b6a0b79ca60e4d2aac313d0b74f9
|
|
BLAKE2b-256 checksum How to use checksums |
061ae24ded244d89d304e40561ea7b48769ca43bd72f4b80aa124f785dfd4a08
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.3 CPython/3.12.9 Darwin/24.3.0
|
Release files / httpx_retry-2025.4.23-py3-none-any.whl
| Download URL | httpx_retry-2025.4.23-py3-none-any.whl |
|---|---|
| Size | 7.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
37cd2040f58d898d621f2bc570716681549d30c45a398f7a6f4935bf3ddbe295
|
|
BLAKE2b-256 checksum How to use checksums |
8c58031ff7789fcbb2eee2284ef9dc9e94a416959acf6e1bef1af807dcf7a34b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.3 CPython/3.12.9 Darwin/24.3.0
|