⚜️ Clientele
Generate loveable Python HTTP API Clients
Clientele lets you generate fully-typed, pythonic HTTP API Clients using an OpenAPI schema.
It's easy to use:
# Install as a global tool - it's not a dependency!
pipx install clientele
# Generate a client
clientele generate -u https://raw.githubusercontent.com/phalt/clientele/main/example_openapi_specs/best.json -o api_client/
Generated code
The generated code is designed by python developers, for python developers.
It uses modern tooling and has a great developer experience.
from my_api import client, schemas
# Pydantic models for inputs and outputs
data = schemas.RequestDataRequest(my_input="test")
# Easy to read client functions
response = client.request_data_request_data_post(data=data)
# Handle responses elegantly
match response:
case schemas.RequestDataResponse():
# Handle valid response
...
case schemas.ValidationError():
# Handle validation error
...
The generated code is tiny - the example schema we use for documentation and testing only requires 250 lines of code and 5 files.
Async support
You can choose to generate either a sync or an async client - we support both:
from my_async_api import client
# Async client functions
response = await client.simple_request_simple_request_get()
Other features
- Written entirely in Python.
- Designed to work with FastAPI's and drf-spectacular's OpenAPI schema generator.
- The generated client only depends on httpx and Pydantic 2.4.
- HTTP Basic and HTTP Bearer authentication support.
- Support your own configuration - we provide an entry point that will never be overwritten.
- Designed for easy testing with respx.
- API updated? Just run the same command again and check the git diff.
- Automatically formats the generated client with black.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file clientele-0.8.3.tar.gz.
File metadata
- Download URL: clientele-0.8.3.tar.gz
- Upload date:
- Size: 17.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.8.10 Linux/5.15.0-87-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d9bcd72e0e9644a23043d25468044fcd97d16b21d90edc2a9d2f564de7b88f9e
|
|
| MD5 |
1dd6227ccdc565bb011f766de6941ed9
|
|
| BLAKE2b-256 |
00559de2f1f1195fde2abf5c3c9d1ddfbdc666db5ac681ebdb29e450db2a16eb
|
File details
Details for the file clientele-0.8.3-py3-none-any.whl.
File metadata
- Download URL: clientele-0.8.3-py3-none-any.whl
- Upload date:
- Size: 26.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.8.10 Linux/5.15.0-87-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
18addee272c9ead872d2c1afca191288f09b54ce2bddd680c1b34f925027b9df
|
|
| MD5 |
6d1781a610b2b6118303c254beddec9e
|
|
| BLAKE2b-256 |
a54cec7e939a23fe00ab507965c582bca8ea5003543915230b2202053b9e5eb2
|