
HTTPX is a fully featured HTTP client for Python 3, which provides sync and async APIs, and support for both HTTP/1.1 and HTTP/2.
Asynchronous Support
Allows non-blocking HTTP requests using `asyncio`, enabling efficient concurrency in web applications.
HTTP/2 Support
Improves performance for multiplexed HTTP connections and is ideal for modern APIs and microservices.
Connection Pooling
Reuses TCP connections across requests, reducing latency and improving efficiency.
Streaming Responses
Enables handling of large downloads or real-time data without loading the entire response into memory.
Session Persistence
Maintains cookies, headers, and connection state across multiple requests, simplifying repeated interactions.
Extensibility and Custom Transports
Allows developers to extend or replace parts of the HTTP stack, providing deep control for specialized use cases.
HTTPX is a next-generation HTTP client for Python, providing a powerful and flexible API for making HTTP requests with full support for asynchronous programming, connection pooling, and HTTP/2.
Supports Python 3.7+; offers sync and async APIs; supports HTTP/1.1 and HTTP/2; built on top of `httpcore`; compatible with WSGI and ASGI; supports connection pooling, cookie persistence, and custom transports.
Building high-performance asynchronous web clients or scrapers.
Making concurrent API requests in microservices or serverless applications.
Testing and simulating HTTP APIs with full request/response customization.
Consuming large data streams from external sources efficiently.
Integrating with third-party APIs that benefit from HTTP/2.
Developing robust applications requiring retries, timeouts, and custom error handling.
HTTPX is a fully featured HTTP client for Python 3, offering asynchronous support via `asyncio`, HTTP/1.1 and HTTP/2 support, connection pooling, and cookie persistence.
HTTPX offers similar API design to `requests` but adds support for asynchronous requests with `asyncio`, HTTP/2 support, and streaming responses, making it more suitable for modern web applications.
Yes, HTTPX supports both synchronous and asynchronous programming styles, making it flexible for different application architectures.
Yes, HTTPX is stable and used in production by many applications. It's actively maintained and backed by the same team that built `httpcore` and `starlette`.
Yes, HTTPX supports a full suite of advanced features including request retries, timeout configuration, custom transport adapters, and redirect handling.