basst¶
Pydantic-first HTTP testing client for Python. Fluent request builder, one-step model binding, native Python assertions.
The name comes from des basst -- southern German dialect for "that fits" or "that's as expected."
Install¶
pip install basst
Or with uv:
uv add basst
Quick Start¶
from basst import Client, matchers
from pydantic import BaseModel
class User(BaseModel):
id: int
name: str
email: str
roles: list[str]
api = Client("https://api.example.com")
user = (
api.get("/users/1")
.header("X-Token", "secret")
.expect()
.status(200)
.header("content-type", matchers.contains("json"))
.model(User)
)
assert user.name == "Ada"
assert "admin" in user.roles
Features¶
- Fluent, chainable request builder (all HTTP verbs)
- Pydantic model binding with
.model()and.model_list() - Automatic content-type validation before parsing
- Built-in header matchers (
equals,contains,starts_with,ends_with,matches) - Custom matchers via simple callables
- Async support (
awaitonly at.expect()) - Contextual error messages with request/response details
from_httpxfor wrapping existing httpx clients
Next: User Guide for the full API.