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.
pip install httpwareOptional extras:
pip install httpware[msgspec] # MsgspecDecoder(otel, niquests, and all extras are declared but their integrations have not shipped yet.)
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)AsyncClient— eight HTTP method shortcuts (get,post,put,patch,delete,head,options,request) with typedresponse_modeloverloads; per-call overrides forheaders,params,cookies,timeout,json,content; httpx-stylebase_urljoin;with_options(...)returns a view sharing the same transport.- Transport-agnostic seam.
httpx2is confined tohttpware.transports.httpx2.Httpx2Transport. Implement theTransportprotocol to swap backends. - Middleware foundation.
Middlewareprotocol,Nexttype alias, recursive-closurecompose()chain composition, and phase decorators (@before_request,@after_response,@on_error). - Pluggable response decoding.
PydanticDecoder(default) with cachedTypeAdapter;MsgspecDecoderviahttpware[msgspec]. RecordedTransport— built-in test double with a route table, observed-request list, andaclose_callscounter.- Status-keyed exception hierarchy —
StatusError, 4xx / 5xx subclasses, plain typed fields (status: int,body: bytes,headers,json,request_method,request_url). Pickleable; userinfo redacted in__repr__. - No
httpx2exception types leak throughhttpware. The transport seam maps them tohttpwareexceptions.
Browse the full list of templates and libraries in modern-python — see the org profile for the categorized index.
MIT — see LICENSE.