Skip to main content

Resilience-first async HTTP client framework for Python

Project description

httpware

Test PyPI version Python versions License: MIT

Async HTTP client framework for Python.

httpware is a typed, async HTTP client library built on httpx2 with a protocol-based seam so the transport is swappable. Middleware composes via an onion model. Pydantic and msgspec response decoding ship out of the box. RecordedTransport replaces respx for transport-level tests.

Status: Pre-1.0 (0.1.0 alpha). Public API is subject to change between minor releases until v1.0. Resilience middleware (retry / timeout / bulkhead), streaming, and observability are not yet shipped — track progress on GitHub.

Install

pip install httpware

Optional extras:

pip install httpware[msgspec]    # MsgspecDecoder

(otel, niquests, and all extras are declared but their integrations have not shipped yet.)

Quickstart

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://api.example.com") as client:
        user = await client.get("/users/1", response_model=User)
        print(user.name)

What ships in 0.1.0

  • AsyncClient — eight HTTP method shortcuts (get, post, put, patch, delete, head, options, request) with typed response_model overloads; per-call overrides for headers, params, cookies, timeout, json, content; httpx-style base_url join; with_options(...) returns a view sharing the same transport.
  • Transport-agnostic seam. httpx2 is confined to httpware.transports.httpx2.Httpx2Transport. Implement the Transport protocol to swap backends.
  • Middleware foundation. Middleware protocol, Next type alias, recursive-closure compose() chain composition, and phase decorators (@before_request, @after_response, @on_error).
  • Pluggable response decoding. PydanticDecoder (default) with cached TypeAdapter; MsgspecDecoder via httpware[msgspec].
  • RecordedTransport — built-in test double with a route table, observed-request list, and aclose_calls counter.
  • Status-keyed exception hierarchyStatusError, 4xx / 5xx subclasses, plain typed fields (status: int, body: bytes, headers, json, request_method, request_url). Pickleable; userinfo redacted in __repr__.
  • No httpx2 exception types leak through httpware. The transport seam maps them to httpware exceptions.

Part of modern-python

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

License

MIT — see LICENSE.

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.1.0.tar.gz (15.0 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.1.0-py3-none-any.whl (20.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: httpware-0.1.0.tar.gz
  • Upload date:
  • Size: 15.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.17 {"installer":{"name":"uv","version":"0.11.17","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.1.0.tar.gz
Algorithm Hash digest
SHA256 5947e51a699137a2d7fd9ab30b947ca529319295a8d610d3505d1c5f4609b3f1
MD5 15dba6606d4909c233fd6f547a96d421
BLAKE2b-256 06889936993de31e49b268239f8607e548dc79159957cba3eb76c38439e7b57a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: httpware-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 20.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.17 {"installer":{"name":"uv","version":"0.11.17","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.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 78d25cf402d9cc4766ea0971741ba1a5903b5ac2906168f146edd371a7760fde
MD5 49c610d6706cbd8936b4fb4743e19c4c
BLAKE2b-256 cfb01d5d787e3a57ba20921d7ee9df973353a3cb325bc092f82d83453f63de8c

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