A next-generation HTTP client for Python with HTTP/1.1 and HTTP/2 support, async/await APIs, and a command-line interface.
HTTPX is a next-generation HTTP client library for Python that provides a comprehensive solution for making HTTP requests. It serves as a modern alternative to the popular `requests` library with additional features like HTTP/2 support, asynchronous capabilities, and an integrated command-line interface. The library addresses the need for a more feature-rich HTTP client that supports both traditional synchronous programming and modern async/await patterns.
Python developers building web applications, API clients, or testing tools who need a robust HTTP client with modern protocol support. It's particularly valuable for developers working with async frameworks or those requiring HTTP/2 capabilities.
Developers choose HTTPX because it combines the familiar, user-friendly API of `requests` with cutting-edge features like HTTP/2 support and async/await compatibility. Its comprehensive feature set, strict timeout enforcement, and full type annotations make it a reliable choice for both simple scripts and production applications.
A next generation HTTP client for Python. 🦋
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Supports both HTTP/1.1 and HTTP/2, with optional HTTP/2 installation for improved performance, as highlighted in the README's features and installation sections.
Provides both synchronous and asynchronous APIs, allowing seamless integration into any codebase, ideal for modern async frameworks without sacrificing backward compatibility.
Maintains a familiar interface for developers transitioning from requests, reducing learning curve and migration effort, as documented in the compatibility guide.
Includes an optional command-line client for making HTTP requests directly from the terminal, enhancing utility for testing and debugging, with rich terminal support via optional dependencies.
Enforces timeout controls throughout all request operations, ensuring robust error handling and preventing hangs, a noted improvement over some other clients.
Requires Python 3.9+, as stated in the Installation section, excluding it from projects still running older Python versions without upgrades.
Advanced features like HTTP/2, CLI, or compression support require additional installations (e.g., httpx[http2]), adding setup steps and potential dependency conflicts.
Compared to requests, HTTPX might have higher overhead for simple synchronous requests due to its additional features and underlying httpcore architecture, which could impact lightweight applications.
While growing, HTTPX has fewer third-party integrations and community plugins compared to the well-established requests library, which might limit tooling options.
httpx is an open-source alternative to the following products: