Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

clientele

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

clientele

Generate loveable Python HTTP API Clients

  • 0.9.0
  • PyPI
  • Socket score

Maintainers
1

⚜️ 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.

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc