HTTPX2
A next-generation Python HTTP client with sync and async APIs, HTTP/2 support, and a built-in command-line client.
Repository Health
Technical Analysis
HTTPX2 is a fully featured, next-generation HTTP client library for Python. It offers both synchronous and asynchronous APIs, supports HTTP/1.1 and HTTP/2, and ships with an integrated command-line client — all behind an interface that feels familiar to Requests users.
HTTPX2 is Pydantic’s maintained continuation of the widely used HTTPX project. With HTTPX seeing limited recent activity, Pydantic has taken stewardship to provide a reliably maintained path forward — including timely security updates for a library that sits in the critical path of countless production systems — while honoring the original project’s design.
What You Get
- Synchronous
Clientand asynchronousAsyncClientsharing one API - HTTP/1.1 and HTTP/2 protocol support
- A Requests-compatible top-level API (
get,post, etc.) - Connection pooling, cookies, redirects, and explicit timeout configuration
- Streaming request and response bodies
- An optional integrated command-line HTTP client
Common Use Cases
- Calling REST and HTTP APIs from synchronous scripts and services
- Making concurrent requests in async applications with
AsyncClient - Talking to HTTP/2 endpoints for multiplexed connections
- Streaming large downloads or uploads without buffering everything in memory
- Making quick ad-hoc requests from the terminal with the built-in CLI
Under The Hood
Architecture — HTTPX2 is layered around a Client (sync) and AsyncClient (async) that manage connection pooling, cookies, redirects, and configuration, delegating the actual byte-level transport to a pluggable transport layer (HTTPTransport/AsyncHTTPTransport) backed by the httpcore engine. Request and Response objects wrap the underlying protocol, with streaming bodies handled lazily. HTTP/2 support is provided through an optional h2-based transport, and the same request-building code path serves both sync and async call styles.
Tech Stack — Pure Python (src layout under src/httpx2) built on httpcore for connection management, certifi for CA bundles, idna for internationalized hostnames, and sniffio/anyio for async-runtime detection. Packaging uses a modern pyproject.toml with optional extras for the CLI (click, rich, pygments) and HTTP/2 (h2); docs are built with mkdocs.
Code Quality — The project carries a substantial test suite (roughly 68 test modules under tests/) exercised by a CI test-suite workflow, inheriting the mature, well-typed codebase of the original HTTPX. Pydantic has taken stewardship specifically to keep it stable and security-patched given its position in the critical path of many production systems.
API Design — The top-level API is deliberately requests-compatible — httpx2.get(), .post(), and a Client context manager feel familiar to anyone coming from Requests — while adding first-class async, explicit timeouts, and typed configuration. An optional integrated command-line client and extensive documentation make it approachable for both quick scripts and production services.