Loveable API Clients from OpenAPI schemas
Project description
⚜️ Clientele
Loveable API Clients from OpenAPI schemasClientele lets you generate fully-typed, loveable Python API Clients from OpenAPI schemas:
from my_api import client, schemas
# Pydantic-typed inputs
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.
Choose either sync or async - we support both, and you can switch between them easily:
from my_async_api import client
# Async client functions
response = await client.simple_request_simple_request_get()
All generated from a single command:
# add -asyncio -t to make it async
clientele generate -u https://raw.githubusercontent.com/phalt/clientele/main/example_openapi_specs/best.json -o api_client/
(That works - try it now!)
Other features
- Supports authentication automatically (curently only HTTP Bearer and HTTP Basic auth).
- Written entirely in Python - no need to install any other languages.
- The client footprint only requires
httpx
andpydantic
. - Support your own configuration - we provide an entry point that will never be overwritten.
- Designed for easy testing with respx.
We're built on:
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
clientele-0.6.0.tar.gz
(13.8 kB
view details)
Built Distribution
clientele-0.6.0-py3-none-any.whl
(18.8 kB
view details)
File details
Details for the file clientele-0.6.0.tar.gz
.
File metadata
- Download URL: clientele-0.6.0.tar.gz
- Upload date:
- Size: 13.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.8.10 Linux/5.15.0-83-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c43bbfadb6310087b2e9ec265dfe76f8e0da3fee60bab99bf26d3482432d0940 |
|
MD5 | 1a0cfb496b159dc1e0399b41e4b7851d |
|
BLAKE2b-256 | b86a7b810eaa023a27dbe1474d70e5e7e9985dd70e497a1524588ee9c2d328a6 |
File details
Details for the file clientele-0.6.0-py3-none-any.whl
.
File metadata
- Download URL: clientele-0.6.0-py3-none-any.whl
- Upload date:
- Size: 18.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.8.10 Linux/5.15.0-83-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4dee06139a2158a815512f397e2fce9329bb4192d2442515406623bc83e5182b |
|
MD5 | 466a8cf1570d8e69abd759855be9f158 |
|
BLAKE2b-256 | 3ea008ea0007eb5b49acae7efb62e1c63260c0a44a5fe0a32b628818617de08c |