Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

HTTPX Tenacity

Package Latest PyPI Version Supported Python Versions
Meta Apache-2.0 Code of Conduct Checked with mypy Code Style Black Linting: Ruff
Automation CI codecov

A lightweight package that provides tenacious (retrying) httpx and httpx2 transports.

Installation

The package is published on PyPI. Plain pip install httpx-tenacity installs only the shared core with the retry policies, which contains no HTTP client. Select the HTTP client you use with an extra, httpx or httpx2.

pip install 'httpx-tenacity[httpx]'
pip install 'httpx-tenacity[httpx2]'

To use both HTTP clients in the same process, install both extras.

pip install 'httpx-tenacity[httpx,httpx2]'

There is no automatic fallback: you choose the integration explicitly by importing from httpx_tenacity.httpx or from httpx_tenacity.httpx2.

Migrating from <0.3

Two breaking changes land in 0.3.0.

First, the transports moved out of the package root and httpx is no longer a required dependency. Install httpx-tenacity[httpx] instead of httpx-tenacity and change your imports. RetryPolicy, SmartRetryPolicy, and RetryingT keep their import paths.

-from httpx_tenacity import AsyncTenaciousTransport, TenaciousTransport
+from httpx_tenacity.httpx import AsyncTenaciousTransport, TenaciousTransport

The same applies to HTTPXHTTPTransportKeywordArguments. For HTTPX2, import the transports from httpx_tenacity.httpx2 instead. The transports' loggers follow their modules and are now named httpx_tenacity.httpx.tenacious_transport and httpx_tenacity.httpx.async_tenacious_transport.

Second, TenaciousTransport.create() and AsyncTenaciousTransport.create() take a policy instead of the max_attempts, multiplier, max_wait_seconds, min_wait_seconds, and exponent_base arguments. Pass them to SmartRetryPolicy.

-transport = TenaciousTransport.create(max_attempts=3)
+transport = TenaciousTransport.create(policy=SmartRetryPolicy(max_attempts=3))

Usage

Wrap the requests of an HTTPX client with a transport that retries server-side issues (HTTP 5xx errors and 429 Too Many Requests responses) and request errors:

import httpx
from httpx_tenacity import SmartRetryPolicy
from httpx_tenacity.httpx import TenaciousTransport

transport = TenaciousTransport.create(policy=SmartRetryPolicy(max_attempts=3))

with httpx.Client(transport=transport) as client:
    response = client.get("https://api.example.com/data")

For HTTPX2, import httpx2 instead of httpx and import the transports from httpx_tenacity.httpx2 instead of httpx_tenacity.httpx; everything else stays the same. The documentation shows every example for both clients, including the asynchronous AsyncTenaciousTransport. Transports, clients, and responses must all come from the same client: httpx_tenacity.httpx works with httpx and httpx_tenacity.httpx2 works with httpx2.

Using Both Clients Together

You can install both extras, httpx-tenacity[httpx,httpx2], and use both integrations in the same process. The retry policies are independent of the HTTP client, so you may even share one policy between them. The HTTP objects, however, are not interchangeable: an httpx_tenacity.httpx transport cannot be used with an httpx2.Client, and an httpx_tenacity.httpx2 transport cannot be used with an httpx.Client.

Metadata

Release files for httpx-tenacity 0.3.0rc1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for httpx-tenacity 0.3.0rc1
File Size Uploaded Provenance Actions
httpx_tenacity-0.3.0rc1.tar.gz 15.9 kB With provenance Details for httpx_tenacity-0.3.0rc1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for httpx-tenacity 0.3.0rc1
File Interpreter ABI Platform Actions
httpx_tenacity-0.3.0rc1-py3-none-any.whl Python 3 none any Details for httpx_tenacity-0.3.0rc1-py3-none-any.whl

Total release size: 40.8 kB

Release files / httpx_tenacity-0.3.0rc1.tar.gz

Download URL httpx_tenacity-0.3.0rc1.tar.gz
Size 15.9 kB
Tags Source
SHA-256 checksum
How to use checksums
78088bd7d45c9a8d468f7225409ceb0b15ee0458b4df0db6a49ae269b64d1485
BLAKE2b-256 checksum
How to use checksums
de1f076ce02067ee759be7880a22d5cbec7a126c373445494164f0103d4ae9e5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.

Transparency log

Release files / httpx_tenacity-0.3.0rc1-py3-none-any.whl

Download URL httpx_tenacity-0.3.0rc1-py3-none-any.whl
Size 24.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2f34b9303e5c4ae17349618681d3f6647beab7d905ebe84d8098fb77304e4159
BLAKE2b-256 checksum
How to use checksums
b0c6229ecd45d94d18064f20019e49e0c5002bfc8f0b9c54501e5739d31e5d8e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.

Transparency log

Security for httpx-tenacity 0.3.0rc1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for httpx_tenacity-0.3.0rc1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page