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

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 already use HTTPX, you can use initialize clients with pyqwest.httpx.PyQwestTransport or pyqwest.httpx.AsyncPyQwestTransport to enable all the features of pyqwest without changing your business logic.

See the API reference for all the APIs available.

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.