Generate API clients by parsing Swagger definitions
Project description
Swagger codegen for Python
Installation
pip install swagger-codegen
Usage example
# Generate Petstore Api client using 'petstore' package name.
swagger_codegen generate http://petstore.swagger.io:8080/api/v3/openapi.json petstore
python
Python 3.8.1 (default, Jan 23 2020, 13:58:52)
[Clang 11.0.0 (clang-1100.0.33.16)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from petstore import new_client, Configuration
>>> from swagger_codegen.api.adapter.requests import RequestsAdapter
>>> from petstore.apis.user.createUser import User
>>> client = new_client(RequestsAdapter(), Configuration(host="http://petstore.swagger.io:8080"))
>>> print(client.user.createUser(User(id=1, username="Swagger-Codegen")))
id=1 username='Swagger-Codegen' firstName=None lastName=None email=None password=None phone=None userStatus=0
You can see example source code for PetStore Api in example directory of a project.
Work in progress
Though library gives nice results for generated API, it is still in development. Some tests are missing. API is a subject to change until stable release.
Anyway backward compatibility will be kept as most as possible.
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
swagger-codegen-0.1.6.tar.gz
(14.5 kB
view details)
Built Distribution
File details
Details for the file swagger-codegen-0.1.6.tar.gz
.
File metadata
- Download URL: swagger-codegen-0.1.6.tar.gz
- Upload date:
- Size: 14.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.0.5 CPython/3.8.1 Darwin/19.4.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 50ed3494d3ed15d463d3c4945ead67a1f9b73dd989a95fcfd3a44661b0494a6f |
|
MD5 | 34d83f1246b57cb2dcaa66f62ca15a35 |
|
BLAKE2b-256 | 30920a8212f6763509801b390872fe08fec42240afc21b5debb1da711c4cc72a |
File details
Details for the file swagger_codegen-0.1.6-py3-none-any.whl
.
File metadata
- Download URL: swagger_codegen-0.1.6-py3-none-any.whl
- Upload date:
- Size: 23.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.0.5 CPython/3.8.1 Darwin/19.4.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ecc10351d06a23c26214203a76e6c379ac61c58d28db22903d2d97fae7bc315c |
|
MD5 | 55331ded5bff3252bc6289b975f62d16 |
|
BLAKE2b-256 | 0b432d3f35d54f299619d3a14e461cf807f7d0c8402e6a9735830795112392b9 |