Generator of python HTTP-clients from OpenApi specification.
Project description
Awesome python HTTP-clients from OpenAPI
Generator of python HTTP-clients from OpenApi specification based on httpx and pydantic
Versions 0.1.* use pydantic v1.* and are no longer supported.
Versions 0.2.* use pydantic v2.*.
Examples
- Sync and async clients for Petstore OpenAPI
Installation
Pip
pip install pythogen
Docker
docker pull artsmolin/pythogen
Generation
path/to/input
— path to the directory with openapi.yaml;path/to/output
— the path to the directory where the generated client will be saved; Pip
pythogen path/to/input/openapi.yaml path/to/output/client.py
Docker
docker run \
-v ./path/to/input:/opt/path/to/input \
-v ./path/to/output:/opt/path/to/output \
artsmolin/pythogen \
path/to/input/openapi.yaml \
path/to/output/client.py
Usage
from petstore.client_async import Client
from petstore.client_async import Pet
from petstore.client_async import EmptyBody
from petstore.client_async import FindPetsByStatusQueryParams
client = Client(base_url="http://your.base.url")
pets: list[Pet] | EmptyBody = await client.findPetsByStatus(
query_params=FindPetsByStatusQueryParams(status="available"),
)
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
pythogen-0.2.10.tar.gz
(20.5 kB
view hashes)
Built Distribution
pythogen-0.2.10-py3-none-any.whl
(28.9 kB
view hashes)
Close
Hashes for pythogen-0.2.10-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 82713bbff726ff986826a048233a7b5786e4cc8ef0a0dcbed548be0b75fc3539 |
|
MD5 | f87013f5dd3927fff86a2e5fb50c9214 |
|
BLAKE2b-256 | 563a67b5068004989a8887132b97c845e4dda80a24a3c9b929ebdb5fb28c322b |