Skip to main content

OpenAPI Python client generator that follows the KISS principle.

Project description

Simple Open API Client generator

This project was made to generate a simple client (async or not) from an openapi specifications (unlike other client generators, which typically produce code that is difficult for python beginners to use). It aims to produce a single file that contains the Client class.

Notes

This project is in alpha and has probably bugs. Issues/bugfixes/additions are welcome.

Installation

$ pip install simple-openapi-client

Usage

This package is usage from a Python script. Simply load the openapi file (from local file or url) and make the client.

For instance:

from simple_openapi_client import parse_openapi, make_client, Config

config = Config(client_name='Orthanc', package_name='client')
document = parse_openapi(url_or_path='https://api.orthanc-server.com/orthanc-openapi.json')
client_str = make_client(document, config, use_black=True)

with open(f'./{config.package_name}.py', 'w') as file:
    file.write(client_str)

Or, for an async client:

from simple_openapi_client import parse_openapi, make_client, Config

config = Config(client_name='AsyncOrthanc', package_name='async_client')
document = parse_openapi(url_or_path='https://api.orthanc-server.com/orthanc-openapi.json')
client_str = make_client(document, config, async_mode=True, use_black=True)

with open(f'./{config.package_name}.py', 'w') as file:
    file.write(client_str)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

simple_openapi_client-0.3.1.tar.gz (7.2 kB view details)

Uploaded Source

Built Distribution

simple_openapi_client-0.3.1-py3-none-any.whl (11.8 kB view details)

Uploaded Python 3

File details

Details for the file simple_openapi_client-0.3.1.tar.gz.

File metadata

  • Download URL: simple_openapi_client-0.3.1.tar.gz
  • Upload date:
  • Size: 7.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.11.4 Linux/6.4.7-200.fc38.x86_64

File hashes

Hashes for simple_openapi_client-0.3.1.tar.gz
Algorithm Hash digest
SHA256 af55dca8b43e6c7e75f27cc2aa279f45a0ecb9c7e568dde51fbdd6f48c26d309
MD5 6a25852457cc751c7d4f45611e03f637
BLAKE2b-256 9107da412c913094ed5dcf5be718e5c49a36a535370330330015d4d5bed16347

See more details on using hashes here.

File details

Details for the file simple_openapi_client-0.3.1-py3-none-any.whl.

File metadata

File hashes

Hashes for simple_openapi_client-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5cbbf75253781cb7f63934327f442ab5323524a85a52925c7a088cc4ed5759c6
MD5 d0bf1f641bc955e980fa033ca6aa2ec6
BLAKE2b-256 f0e56a88c1e8a823b2a40bdd1cd104144dad3a87b1b0c5433ec88a7e8b66241f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page