Metadata-Version: 2.1
Name: pythogen
Version: 0.1.23
Summary: Generator of python HTTP-clients from OpenApi specification.
Home-page: https://github.com/artsmolin/pythogen
License: MIT
Keywords: openapi,openapi-generator,swagger,http-client,generator
Author: Artur Smolin
Author-email: artursmolin@outlook.com
Requires-Python: >=3.7,<4.0
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Topic :: Software Development :: Code Generators
Classifier: Topic :: Utilities
Classifier: Typing :: Typed
Requires-Dist: black (>=23.3.0,<24.0.0)
Requires-Dist: inflection (>=0.5.1,<0.6.0)
Requires-Dist: jinja2 (>=3.1.1,<4.0.0)
Requires-Dist: pyyaml (>=6.0,<7.0)
Requires-Dist: rich (>=12.2.0,<13.0.0)
Requires-Dist: typer (>=0.4.1,<0.5.0)
Project-URL: Repository, https://github.com/artsmolin/pythogen
Description-Content-Type: text/markdown

<div>
  <p align="center">
    <img src="docs/images/logo_long.png" height="auto" width="400px">
  </p>
  <br/>
</div>

Generator of python HTTP-clients from OpenApi specification based on [httpx](https://github.com/projectdiscovery/httpx) and [pydantic](https://github.com/pydantic/pydantic).

[![Build Status](https://github.com/artsmolin/pythogen/actions/workflows/main.yml/badge.svg)](https://github.com/artsmolin/pythogen/actions)
[![codecov](https://codecov.io/gh/artsmolin/pythogen/branch/main/graph/badge.svg?token=6JR6NB8Y9Z)](https://codecov.io/gh/artsmolin/pythogen)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)

[![Python](https://img.shields.io/pypi/pyversions/pythogen.svg)](https://pypi.python.org/pypi/pythogen/)
[![pypi](https://img.shields.io/pypi/v/pythogen.svg)](https://pypi.org/project/pythogen/)

[![license](https://img.shields.io/github/license/artsmolin/pythogen.svg)](https://github.com/artsmolin/pythogen/blob/master/LICENSE)

---

<p align="center">
  <img src="docs/images/example.png">
</p>

## Features
- [Discriminator](/docs/discriminator.md)
- [Metrics](/docs/metrics.md)
- [Logs](/docs/logs.md)
- [Required Headers](/docs/headers.md)
- [Sync/async clients](/docs/sync_async.md)
- [Client as python-package](/docs/client_as_pkg.md)

## Examples
- [Sync](/examples/petstore/client_sync.py) and [async](/examples/petstore/client_async.py) clients for [Petstore OpenAPI](/examples/petstore/openapi.yaml)

## Installing the library and generating clients
By Docker
```shell
docker pull artsmolin/pythogen
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
```
or directly
```shell
pip install pythogen
pythogen path/to/input/openapi.yaml path/to/output/client.py
```
## Usage client
```python
from petstore.client_async import Client
from petstore.client_async import Pet
from petstore.client_async import EmptyBody

client = Client(base_url="http://your.base.url")
pets: list[Pet] | EmptyBody = await client.findPetsByStatus(status="available")
```

[Development](/docs/development.md)

