# 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
```shell
$ 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:
```py
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:
```py
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)
```
Raw data
{
"_id": null,
"home_page": "https://github.com/gacou54/openapi-client",
"name": "simple-openapi-client",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.8",
"maintainer_email": null,
"keywords": null,
"author": "Gabriel Couture",
"author_email": "gacou54@gmail.ca",
"download_url": "https://files.pythonhosted.org/packages/06/30/18f2e315bbbf95b90f0a98af092cd6f6d8b0326e734fb7c51369ecaf85e5/simple_openapi_client-0.5.4.tar.gz",
"platform": null,
"description": "# Simple Open API Client generator\n\nThis project was made to generate a simple client (async or not) from an openapi\nspecifications (unlike other client generators, which typically produce\ncode that is difficult for python beginners to use). It aims to produce a\nsingle file that contains the Client class.\n\n## Notes\nThis project is in alpha and has probably bugs.\nIssues/bugfixes/additions are welcome.\n\n## Installation\n```shell\n$ pip install simple-openapi-client\n```\n\n## Usage\n\nThis package is usage from a Python script.\nSimply load the openapi file (from local file or url) and make the client.\n\nFor instance:\n\n```py\nfrom simple_openapi_client import parse_openapi, make_client, Config\n\nconfig = Config(client_name='Orthanc', package_name='client')\ndocument = parse_openapi(url_or_path='https://api.orthanc-server.com/orthanc-openapi.json')\nclient_str = make_client(document, config, use_black=True)\n\nwith open(f'./{config.package_name}.py', 'w') as file:\n file.write(client_str)\n```\n\nOr, for an async client:\n\n```py\nfrom simple_openapi_client import parse_openapi, make_client, Config\n\nconfig = Config(client_name='AsyncOrthanc', package_name='async_client')\ndocument = parse_openapi(url_or_path='https://api.orthanc-server.com/orthanc-openapi.json')\nclient_str = make_client(document, config, async_mode=True, use_black=True)\n\nwith open(f'./{config.package_name}.py', 'w') as file:\n file.write(client_str)\n```\n",
"bugtrack_url": null,
"license": "BSD-3-Clause",
"summary": "OpenAPI Python client generator that follows the KISS principle.",
"version": "0.5.4",
"project_urls": {
"Homepage": "https://github.com/gacou54/openapi-client"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "a8c819d9ac27e54f10ba4476e7574dc56c37367309007f40a7522ff4a402f3aa",
"md5": "bac65e965828cb571c6c6d6c8544a363",
"sha256": "8c175557b6e4adf37300fe7687b21f806571c74cc5a836a232ab13c6269ed069"
},
"downloads": -1,
"filename": "simple_openapi_client-0.5.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "bac65e965828cb571c6c6d6c8544a363",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.8",
"size": 11962,
"upload_time": "2024-05-30T13:20:59",
"upload_time_iso_8601": "2024-05-30T13:20:59.465161Z",
"url": "https://files.pythonhosted.org/packages/a8/c8/19d9ac27e54f10ba4476e7574dc56c37367309007f40a7522ff4a402f3aa/simple_openapi_client-0.5.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "063018f2e315bbbf95b90f0a98af092cd6f6d8b0326e734fb7c51369ecaf85e5",
"md5": "bb51dac914fa4362c0ef6e9a57228959",
"sha256": "02899d8401bb461d9f885755f014c613ea192e445ddefbd6af1888792a675f9a"
},
"downloads": -1,
"filename": "simple_openapi_client-0.5.4.tar.gz",
"has_sig": false,
"md5_digest": "bb51dac914fa4362c0ef6e9a57228959",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.8",
"size": 7365,
"upload_time": "2024-05-30T13:21:00",
"upload_time_iso_8601": "2024-05-30T13:21:00.581384Z",
"url": "https://files.pythonhosted.org/packages/06/30/18f2e315bbbf95b90f0a98af092cd6f6d8b0326e734fb7c51369ecaf85e5/simple_openapi_client-0.5.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-05-30 13:21:00",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "gacou54",
"github_project": "openapi-client",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "simple-openapi-client"
}