Metadata-Version: 2.4
Name: basst
Version: 0.1.1
Summary: Fluent HTTP API testing library with Pydantic model binding
Keywords: http,testing,api,pydantic,httpx,fluent
Author: Gitznik
Author-email: Gitznik <dev@robswebhub.net>
License-Expression: MIT
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Testing
Classifier: Typing :: Typed
Requires-Dist: httpx>=0.24
Requires-Dist: pydantic>=2.0
Requires-Python: >=3.11
Project-URL: Documentation, https://basst.readthedocs.io
Project-URL: Issues, https://codeberg.org/Gitznik/basst/issues
Project-URL: Repository, https://codeberg.org/Gitznik/basst
Description-Content-Type: text/markdown

# basst

Pydantic-first HTTP testing client for Python. Fluent request builder, one-step model binding, native Python assertions.

## Install

```bash
pip install basst
```

## Quick Start

```python
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 (`await` only at `.expect()`)
- Contextual error messages with request/response details
- `from_httpx` for wrapping existing httpx clients

## Documentation

Full documentation at [basst.readthedocs.io](https://basst.readthedocs.io).

## Inspiration

basst draws inspiration from [REST Assured](https://rest-assured.io/) (Java) and [gavv/httpexpect](https://github.com/gavv/httpexpect) (Go).

## License

MIT
