Middleware for implementing retry policies with HTTPX
Project description
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.
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
83f7666c4844cb6e57107a55dac46f2a5418b6a0b79ca60e4d2aac313d0b74f9
|
|
| MD5 |
6912219d7ae13a5636764b13e6f61463
|
|
| BLAKE2b-256 |
061ae24ded244d89d304e40561ea7b48769ca43bd72f4b80aa124f785dfd4a08
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
37cd2040f58d898d621f2bc570716681549d30c45a398f7a6f4935bf3ddbe295
|
|
| MD5 |
2514a81676f7155d53e295a3983a1f54
|
|
| BLAKE2b-256 |
8c58031ff7789fcbb2eee2284ef9dc9e94a416959acf6e1bef1af807dcf7a34b
|