Skip to content

logo

A Python HTTP client built on reqwest

license ci codecov pypi version

pyqwest is a Python HTTP client supporting modern HTTP features, based on the Rust library reqwest. It does not reinvent any features of HTTP or sockets, delegating to the excellent reqwest, which uses hyper, for all core functionality while presenting a familiar Pythonic API.

Features

  • All features of HTTP, including bidirectional streaming, trailers, and HTTP/3
  • Async and sync clients
  • The stability and performance of the Rust HTTP client stack
  • A fully-typed, Pythonic API - no runtime-checked union types
  • An adapter to allow dropping into existing codebases using HTTPX

Quickstart

pyqwest is available on PyPI so can be installed using your favorite package manager.

uv add pyqwest
pip install pyqwest

The Client and SyncClient classes can be used to make requests. By default, they will use a shared connection pool and are safe to use for production.

client = pyqwest.Client()

response = await client.get("https://curioswitch.org")
print(len(response.content))
client = pyqwest.SyncClient()

response = client.get("https://curioswitch.org")
print(len(response.content))

If you are already using HTTPX, you can initialize clients with either pyqwest.httpx.PyQwestTransport or pyqwest.httpx.AsyncPyQwestTransport to enable all the features of pyqwest without changing your business logic.

Check out the API reference page for all the available APIs.

Why pyqwest?

pyqwest was created out of a desire to bring bidirectional streaming and HTTP/2 trailers to Python HTTP clients to allow using the gRPC protocol with standard applications - it powers the gRPC client functionality in connect-python. While developing it, we have found it to be a very fast, stable client for any workload.