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
Documentation
Check documentation to see more details about the features. All documentation is in the "docs" directory and online at artsmolin.github.io/pythogen
Examples
- Sync and async clients for Petstore OpenAPI
Installation
You can install the library
pip install pythogen
or use 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;
Generate a client using the installed library
pythogen path/to/input/openapi.yaml path/to/output/client.py
or via 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.35.tar.gz
(22.3 kB
view hashes)
Built Distribution
pythogen-0.2.35-py3-none-any.whl
(30.7 kB
view hashes)
Close
Hashes for pythogen-0.2.35-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a1247ba3f0a722c587ee9514de612c5a90a3acbe44559986fa632db36bc3a29e |
|
MD5 | abf4347b5979656baa2dfbd3078dd5c1 |
|
BLAKE2b-256 | b4e5653061722e0176eaa98dba0bb7cb6aefc54e43e957b63c16e6e172005271 |