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)

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)

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.2.0.tar.gz (7.7 kB view details)

Uploaded Source

Built Distribution

simple_openapi_client-0.2.0-py3-none-any.whl (11.7 kB view details)

Uploaded Python 3

File details

Details for the file simple-openapi-client-0.2.0.tar.gz.

File metadata

  • Download URL: simple-openapi-client-0.2.0.tar.gz
  • Upload date:
  • Size: 7.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.10.5 Linux/5.18.13-200.fc36.x86_64

File hashes

Hashes for simple-openapi-client-0.2.0.tar.gz
Algorithm Hash digest
SHA256 a5079735f9e6b5bb441a711091b544d580b50dc2024147571b2881ba6b236fa7
MD5 a5505f9e87c21d25a4e9959d163fa1f4
BLAKE2b-256 ed0021f4b718a1690db490de183950f15cffabd2467dc78f97ddb548b67e9a59

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for simple_openapi_client-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4101cd4511d1515151405b992a3426dc0b1939da8029be10dc343be61d0f163b
MD5 1f06ba93aded74ef5ee604801e75d3b3
BLAKE2b-256 ba15d4bee61e340a82258790afd2794d3b6554717fca1ddb4462a0c3894c6609

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