Definition
A modern Python HTTP client that supports both sync and async APIs — drop-in replacement for requests, with HTTP/2 support and seamless asyncio integration.
In Depth
httpx provides a requests-compatible API with two key additions: native async/await support (`async with httpx.AsyncClient()`), and HTTP/2. Sync code reads almost identically to requests, so migration is straightforward. For async services (FastAPI, asyncio-based workers), httpx is the standard choice because requests has no async support. Built-in connection pooling, retries (via httpx-retry), and middleware.
Example Usage
Migrating a FastAPI service's outbound calls from requests (blocking the event loop) to httpx.AsyncClient (non-blocking) — 5× throughput.
Business Context
httpx is the modern Python HTTP client of choice — requests-compatible for sync, async-native for FastAPI and other modern frameworks.
Also Known As
Tags
Quick Info
Need help implementing this in your business?
Get Started