pyreqwest 0.15.2


pip install pyreqwest

  Latest version

Released: Nov 21, 2026

Project Links

Meta
Author: Markus Sintonen
Requires Python: >=3.11

Classifiers

Development Status
  • 4 - Beta

Programming Language
  • Python
  • Python :: 3
  • Python :: 3 :: Only
  • Python :: 3.11
  • Python :: 3.12
  • Python :: 3.13
  • Python :: 3.14
  • Python :: 3.15
  • Python :: Implementation :: CPython
  • Python :: Implementation :: PyPy
  • Python :: Implementation :: GraalPy
  • Rust

Intended Audience
  • Developers
  • Information Technology

Operating System
  • POSIX :: Linux
  • Microsoft :: Windows
  • MacOS

Typing
  • Typed

logo


codecov PyPI - Python Version

pyreqwest - Powerful and fast Rust based HTTP client. Built on top of and inspired by reqwest.

Why

  • No reinvention of the wheel - built on top of widely used reqwest and other Rust HTTP crates
  • Secure and fast - no C-extension code, no Python code/dependencies, no unsafe code
  • Ergonomic and easy to use - similar API as in reqwest, fully type-annotated
  • Testing ergonomics - mocking included, can also connect into ASGI apps

Using this is a good choice when:

  • You care about throughput and latency, especially in high concurrency scenarios
  • You want a single solution to serve all your HTTP client needs

This is not a good choice when:

  • You want a pure Python solution allowing debugging of the HTTP client internals
  • You use alternative Python implementations or Python version older than 3.11

Features

  • High performance, see notes and benchmarks
  • Asynchronous and synchronous HTTP clients
  • Customizable via middlewares and custom JSON serializers
  • Ergonomic as reqwest
  • HTTP/1.1 and HTTP/2 support (also HTTP/3 when it stabilizes)
  • Mocking and testing utilities (can also connect to ASGI apps)
  • Fully type-safe with Python type hints
  • Full test coverage
  • Free threading, see notes

Standard HTTP features you would expect

  • HTTPS support (using rustls)
  • Request and response body streaming
  • Connection pooling
  • JSON, URLs, Headers, Cookies etc. (all serializers in Rust)
  • Automatic decompression (zstd, gzip, brotli, deflate)
  • Automatic response decoding (charset detection)
  • Multipart form support
  • Proxy support (also SOCKS)
  • Redirects
  • Timeouts
  • Authentication (Basic, Bearer)
  • Cookie management

Quickstart

# uv add pyreqwest

from pyreqwest.client import ClientBuilder, SyncClientBuilder


async def example_async():
    async with ClientBuilder().error_for_status(True).build() as client:
        response = await client.get("https://httpbun.com/get").query({"q": "val"}).build().send()
        print(await response.json())


def example_sync():
    with SyncClientBuilder().error_for_status(True).build() as client:
        print(client.get("https://httpbun.com/get").query({"q": "val"}).build().send().json())

Context manager usage is optional, but recommended. Also close() methods are available.

Mocking in pytest

from pyreqwest.client import ClientBuilder
from pyreqwest.pytest_plugin import ClientMocker


async def test_client(client_mocker: ClientMocker) -> None:
    client_mocker.get(path="/api").with_body_text("Hello Mock")

    async with ClientBuilder().build() as client:
        response = await client.get("http://example.invalid/api").build().send()
        assert response.status == 200 and await response.text() == "Hello Mock"
        assert client_mocker.get_call_count() == 1

Manual mocking is available via ClientMocker.create_mocker(MonkeyPatch).

Simple request interface

This is only recommended for simple use-cases such as scripts. Usually, the full client API should be used which reuses connections and has other optimizations.

# Sync example
from pyreqwest.simple.sync_request import pyreqwest_get

response = pyreqwest_get("https://httpbun.com/get").query({"q": "val"}).send()
print(response.json())
# Async example
from pyreqwest.simple.request import pyreqwest_get

response = await pyreqwest_get("https://httpbun.com/get").query({"q": "val"}).send()
print(await response.json())

Documentation

See docs

See examples

Compatibility with other libraries

See compatibility docs

Wheel compatibility matrix

Platform CPython 3.11 CPython 3.12 CPython 3.13 CPython 3.14 CPython 3.15 CPython (additional flags: t) 3.14 CPython (additional flags: t) 3.15
macosx_10_12_x86_64
macosx_11_0_arm64
manylinux2014_aarch64
manylinux2014_armv7l
manylinux2014_i686
manylinux2014_s390x
manylinux2014_x86_64
manylinux_2_17_aarch64
manylinux_2_17_armv7l
manylinux_2_17_i686
manylinux_2_17_s390x
manylinux_2_17_x86_64
manylinux_2_28_ppc64le
musllinux_1_1_aarch64
musllinux_1_1_armv7l
musllinux_1_1_x86_64
win_amd64
win_arm64

Files in release

pyreqwest-0.15.2-cp311-cp311-macosx_10_12_x86_64.whl (3.9MiB)
pyreqwest-0.15.2-cp311-cp311-macosx_11_0_arm64.whl (3.7MiB)
pyreqwest-0.15.2-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.whl (3.8MiB)
pyreqwest-0.15.2-cp311-cp311-manylinux2014_armv7l.manylinux_2_17_armv7l.whl (3.3MiB)
pyreqwest-0.15.2-cp311-cp311-manylinux2014_i686.manylinux_2_17_i686.whl (3.8MiB)
pyreqwest-0.15.2-cp311-cp311-manylinux2014_s390x.manylinux_2_17_s390x.whl (3.7MiB)
pyreqwest-0.15.2-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (4.1MiB)
pyreqwest-0.15.2-cp311-cp311-manylinux_2_28_ppc64le.whl (3.8MiB)
pyreqwest-0.15.2-cp311-cp311-musllinux_1_1_aarch64.whl (4.0MiB)
pyreqwest-0.15.2-cp311-cp311-musllinux_1_1_armv7l.whl (3.5MiB)
pyreqwest-0.15.2-cp311-cp311-musllinux_1_1_x86_64.whl (4.3MiB)
pyreqwest-0.15.2-cp311-cp311-win_amd64.whl (3.7MiB)
pyreqwest-0.15.2-cp311-cp311-win_arm64.whl (3.7MiB)
pyreqwest-0.15.2-cp312-cp312-macosx_10_12_x86_64.whl (4.0MiB)
pyreqwest-0.15.2-cp312-cp312-macosx_11_0_arm64.whl (3.7MiB)
pyreqwest-0.15.2-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.whl (3.8MiB)
pyreqwest-0.15.2-cp312-cp312-manylinux2014_armv7l.manylinux_2_17_armv7l.whl (3.3MiB)
pyreqwest-0.15.2-cp312-cp312-manylinux2014_i686.manylinux_2_17_i686.whl (3.7MiB)
pyreqwest-0.15.2-cp312-cp312-manylinux2014_s390x.manylinux_2_17_s390x.whl (3.6MiB)
pyreqwest-0.15.2-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (4.0MiB)
pyreqwest-0.15.2-cp312-cp312-manylinux_2_28_ppc64le.whl (3.8MiB)
pyreqwest-0.15.2-cp312-cp312-musllinux_1_1_aarch64.whl (4.0MiB)
pyreqwest-0.15.2-cp312-cp312-musllinux_1_1_armv7l.whl (3.5MiB)
pyreqwest-0.15.2-cp312-cp312-musllinux_1_1_x86_64.whl (4.3MiB)
pyreqwest-0.15.2-cp312-cp312-win_amd64.whl (3.7MiB)
pyreqwest-0.15.2-cp312-cp312-win_arm64.whl (3.7MiB)
pyreqwest-0.15.2-cp313-cp313-macosx_10_12_x86_64.whl (4.0MiB)
pyreqwest-0.15.2-cp313-cp313-macosx_11_0_arm64.whl (3.7MiB)
pyreqwest-0.15.2-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.whl (3.8MiB)
pyreqwest-0.15.2-cp313-cp313-manylinux2014_armv7l.manylinux_2_17_armv7l.whl (3.3MiB)
pyreqwest-0.15.2-cp313-cp313-manylinux2014_i686.manylinux_2_17_i686.whl (3.7MiB)
pyreqwest-0.15.2-cp313-cp313-manylinux2014_s390x.manylinux_2_17_s390x.whl (3.6MiB)
pyreqwest-0.15.2-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (4.0MiB)
pyreqwest-0.15.2-cp313-cp313-manylinux_2_28_ppc64le.whl (3.8MiB)
pyreqwest-0.15.2-cp313-cp313-musllinux_1_1_aarch64.whl (4.0MiB)
pyreqwest-0.15.2-cp313-cp313-musllinux_1_1_armv7l.whl (3.5MiB)
pyreqwest-0.15.2-cp313-cp313-musllinux_1_1_x86_64.whl (4.3MiB)
pyreqwest-0.15.2-cp313-cp313-win_amd64.whl (3.7MiB)
pyreqwest-0.15.2-cp313-cp313-win_arm64.whl (3.7MiB)
pyreqwest-0.15.2-cp314-cp314-macosx_10_12_x86_64.whl (4.0MiB)
pyreqwest-0.15.2-cp314-cp314-macosx_11_0_arm64.whl (3.7MiB)
pyreqwest-0.15.2-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.whl (3.8MiB)
pyreqwest-0.15.2-cp314-cp314-manylinux2014_armv7l.manylinux_2_17_armv7l.whl (3.3MiB)
pyreqwest-0.15.2-cp314-cp314-manylinux2014_i686.manylinux_2_17_i686.whl (3.7MiB)
pyreqwest-0.15.2-cp314-cp314-manylinux2014_s390x.manylinux_2_17_s390x.whl (3.7MiB)
pyreqwest-0.15.2-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (4.0MiB)
pyreqwest-0.15.2-cp314-cp314-manylinux_2_28_ppc64le.whl (3.8MiB)
pyreqwest-0.15.2-cp314-cp314-musllinux_1_1_aarch64.whl (4.0MiB)
pyreqwest-0.15.2-cp314-cp314-musllinux_1_1_armv7l.whl (3.5MiB)
pyreqwest-0.15.2-cp314-cp314-musllinux_1_1_x86_64.whl (4.3MiB)
pyreqwest-0.15.2-cp314-cp314-win_amd64.whl (3.7MiB)
pyreqwest-0.15.2-cp314-cp314-win_arm64.whl (3.7MiB)
pyreqwest-0.15.2-cp314-cp314t-macosx_10_12_x86_64.whl (4.0MiB)
pyreqwest-0.15.2-cp314-cp314t-macosx_11_0_arm64.whl (3.7MiB)
pyreqwest-0.15.2-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.whl (3.8MiB)
pyreqwest-0.15.2-cp314-cp314t-manylinux2014_armv7l.manylinux_2_17_armv7l.whl (3.3MiB)
pyreqwest-0.15.2-cp314-cp314t-manylinux2014_i686.manylinux_2_17_i686.whl (3.7MiB)
pyreqwest-0.15.2-cp314-cp314t-manylinux2014_s390x.manylinux_2_17_s390x.whl (3.7MiB)
pyreqwest-0.15.2-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (4.0MiB)
pyreqwest-0.15.2-cp314-cp314t-manylinux_2_28_ppc64le.whl (3.8MiB)
pyreqwest-0.15.2-cp314-cp314t-musllinux_1_1_aarch64.whl (4.0MiB)
pyreqwest-0.15.2-cp314-cp314t-musllinux_1_1_armv7l.whl (3.5MiB)
pyreqwest-0.15.2-cp314-cp314t-musllinux_1_1_x86_64.whl (4.3MiB)
pyreqwest-0.15.2-cp314-cp314t-win_amd64.whl (3.7MiB)
pyreqwest-0.15.2-cp314-cp314t-win_arm64.whl (3.7MiB)
pyreqwest-0.15.2-cp315-cp315-macosx_10_12_x86_64.whl (4.0MiB)
pyreqwest-0.15.2-cp315-cp315-macosx_11_0_arm64.whl (3.7MiB)
pyreqwest-0.15.2-cp315-cp315-manylinux2014_aarch64.manylinux_2_17_aarch64.whl (3.8MiB)
pyreqwest-0.15.2-cp315-cp315-manylinux2014_armv7l.manylinux_2_17_armv7l.whl (3.3MiB)
pyreqwest-0.15.2-cp315-cp315-manylinux2014_i686.manylinux_2_17_i686.whl (3.7MiB)
pyreqwest-0.15.2-cp315-cp315-manylinux2014_s390x.manylinux_2_17_s390x.whl (3.7MiB)
pyreqwest-0.15.2-cp315-cp315-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (4.0MiB)
pyreqwest-0.15.2-cp315-cp315-manylinux_2_28_ppc64le.whl (3.8MiB)
pyreqwest-0.15.2-cp315-cp315-musllinux_1_1_aarch64.whl (4.0MiB)
pyreqwest-0.15.2-cp315-cp315-musllinux_1_1_armv7l.whl (3.5MiB)
pyreqwest-0.15.2-cp315-cp315-musllinux_1_1_x86_64.whl (4.3MiB)
pyreqwest-0.15.2-cp315-cp315-win_amd64.whl (3.7MiB)
pyreqwest-0.15.2-cp315-cp315-win_arm64.whl (3.7MiB)
pyreqwest-0.15.2-cp315-cp315t-macosx_10_12_x86_64.whl (4.0MiB)
pyreqwest-0.15.2-cp315-cp315t-macosx_11_0_arm64.whl (3.7MiB)
pyreqwest-0.15.2-cp315-cp315t-manylinux2014_aarch64.manylinux_2_17_aarch64.whl (3.8MiB)
pyreqwest-0.15.2-cp315-cp315t-manylinux2014_armv7l.manylinux_2_17_armv7l.whl (3.3MiB)
pyreqwest-0.15.2-cp315-cp315t-manylinux2014_i686.manylinux_2_17_i686.whl (3.7MiB)
pyreqwest-0.15.2-cp315-cp315t-manylinux2014_s390x.manylinux_2_17_s390x.whl (3.7MiB)
pyreqwest-0.15.2-cp315-cp315t-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (4.0MiB)
pyreqwest-0.15.2-cp315-cp315t-manylinux_2_28_ppc64le.whl (3.8MiB)
pyreqwest-0.15.2-cp315-cp315t-musllinux_1_1_aarch64.whl (4.0MiB)
pyreqwest-0.15.2-cp315-cp315t-musllinux_1_1_armv7l.whl (3.5MiB)
pyreqwest-0.15.2-cp315-cp315t-musllinux_1_1_x86_64.whl (4.3MiB)
pyreqwest-0.15.2-cp315-cp315t-win_amd64.whl (3.7MiB)
pyreqwest-0.15.2-cp315-cp315t-win_arm64.whl (3.7MiB)
pyreqwest-0.15.2.tar.gz (4.3MiB)
No dependencies