news.volyx.in

Httpx: A next-generation HTTP client for Python (python-httpx.org)

463 points by tomchristie · 2468 days ago · 115 comments on HN

Article summary

Httpx is a next-generation HTTP client for Python that provides sync and async APIs, and support for both HTTP/1.1 and HTTP/2. It offers a broadly requests-compatible API, standard synchronous interface, and async support. Httpx also includes features such as international domains and URLs, keep-alive and connection pooling, and browser-style SSL verification. The library can be installed using pip and requires Python 3.9+.

Main themes

  • http client
  • async support
  • python libraries
  • http/2 support
  • requests compatibility
  • async web frameworks

What commenters say

  • Httpx offers significant advantages over the popular requests library, including proper async support and HTTP/2 support without patching.
  • The library's API is similar to requests, but with additional features and better support for advanced use cases.
  • Some users find httpx to be a superior library to requests due to its more comprehensive feature set and better exception handling.
  • The choice of async web framework is highly dependent on individual project needs, with options including FastAPI, Starlette, and aiohttp.
  • Httpx may not be suitable for all use cases, particularly those that require low-level control or custom authentication flows.
  • The library's documentation and examples are clear and easy to follow, making it a good choice for developers new to async programming.
  • Some users prefer other libraries, such as aiohttp or peewee, due to their specific features and use cases.