Skip to main content

Resilience-first async HTTP client framework for Python

Project description

httpware

PyPI version Supported Python versions Downloads Coverage CI License GitHub stars Context7 uv Ruff ty

A Python HTTP client framework with sync and async clients for building resilient service clients.

Why httpware

  • Typed errors, no raise_for_status() — 4xx/5xx automatically raise a status-keyed exception tree (NotFoundError, RateLimitedError, …), all under httpware.StatusError.
  • Typed response bodiesresponse_model=YourType decodes the body straight to your pydantic or msgspec model; a missing decoder fails fast, before the request goes out.
  • Production resilience as composable middleware — retry + retry-budget, bulkhead, circuit breaker, and timeout, composed at construction — all over standard httpx2.

Built on httpx2: httpware re-exports httpx2.Request/httpx2.Response and stays a thin wrapper, not a new HTTP abstraction.

Status: Pre-1.0. Public API is subject to change between minor releases until v1.0.

Install

pip install httpware                # core only — no decoder
pip install httpware[pydantic]      # + PydanticDecoder — BaseModel, dataclasses, primitives, generics
pip install httpware[msgspec]       # + MsgspecDecoder — Struct, dataclasses, primitives, generics
pip install httpware[pydantic,msgspec]   # both — BaseModel routes to pydantic, Struct to msgspec
pip install httpware[all]           # everything (pydantic, msgspec, otel)

Quickstart

A typed GET against a live API (needs pip install httpware[pydantic]):

import asyncio

from httpware import AsyncClient
from pydantic import BaseModel


class User(BaseModel):
    id: int
    name: str


async def main() -> None:
    async with AsyncClient(base_url="https://jsonplaceholder.typicode.com") as client:
        user = await client.get("/users/1", response_model=User)
        print(user.name)  # Leanne Graham


asyncio.run(main())

The sync Client is identical — swap AsyncClientClient and drop the await / async with. A 4xx/5xx response raises a typed StatusError; a malformed body raises DecodeError. Both subclass httpware.ClientError.

Documentation

Full guides live at httpware.modern-python.org:

  • Quickstart & observability — resilience middleware, streaming, and the stable logger/event contract.
  • Middleware — write your own (auth, tracing, request-ID propagation).
  • Resilience — retry + retry-budget, bulkhead, circuit breaker, timeout.
  • Errors — the exception tree and catching strategies.
  • Testinghttpx2.MockTransport injection.
  • Recipes — DI wiring, phase-decorator patterns, link-header pagination.

🗒️ Release notes · 📦 PyPI · 📝 License

Part of modern-python

Browse the full list of templates and libraries in modern-python — see the org profile for the categorized index.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

httpware-0.11.0.tar.gz (28.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

httpware-0.11.0-py3-none-any.whl (37.7 kB view details)

Uploaded Python 3

File details

Details for the file httpware-0.11.0.tar.gz.

File metadata

  • Download URL: httpware-0.11.0.tar.gz
  • Upload date:
  • Size: 28.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for httpware-0.11.0.tar.gz
Algorithm Hash digest
SHA256 3ee90f2247b07895329e3647939215e68507693399903e3e7bea47de55a28ee2
MD5 4a1763e277e15950701fbac380fedc54
BLAKE2b-256 b0310cf10332ec3ff44541a300834110883252c3126215c962c9b857b3be99ee

See more details on using hashes here.

File details

Details for the file httpware-0.11.0-py3-none-any.whl.

File metadata

  • Download URL: httpware-0.11.0-py3-none-any.whl
  • Upload date:
  • Size: 37.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for httpware-0.11.0-py3-none-any.whl
Algorithm Hash digest
SHA256 49f1709d1e3bab6a7599543e4eae62e2d522562eea5a49ad3c04a6348dcc678f
MD5 5df592de88ec8e4d59d8d6af8c1a3d15
BLAKE2b-256 2bd21321147c5db5f2c2135c73fdfb0461ff56246485d1ced5803626b9b3c82b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page