Skip to main content

⚜️ Clientele

Generate loveable Python HTTP API Clients

Package version PyPI - Python Version PyPI - Downloads PyPI - License

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

clientele-0.8.1.tar.gz (16.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

clientele-0.8.1-py3-none-any.whl (26.4 kB view details)

Uploaded Python 3

File details

Details for the file clientele-0.8.1.tar.gz.

File metadata

  • Download URL: clientele-0.8.1.tar.gz
  • Upload date:
  • Size: 16.9 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

Hashes for clientele-0.8.1.tar.gz
Algorithm Hash digest
SHA256 69a3c0ccda583b6fb6d885bd9f5bcf4415763a9b233ffa5ef0ea9e4719df5dc1
MD5 386b1796552774bbe1bb884de4101c31
BLAKE2b-256 9fe17f310716987783f12670d751e23ae76f6a02efe72b8853bde6f98d27c3ed

See more details on using hashes here.

File details

Details for the file clientele-0.8.1-py3-none-any.whl.

File metadata

  • Download URL: clientele-0.8.1-py3-none-any.whl
  • Upload date:
  • Size: 26.4 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

Hashes for clientele-0.8.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b28a23193b8a41d46792f0dacaf0cb3fb3d2e77b8f6b7c096999de0e7b1a0d4a
MD5 e9e93fa088971a6c58a9778015703847
BLAKE2b-256 a2381f1944dd10f8b4113f8fd4149d5f4dbecbe4b169891d47e3212879c3e9b1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page