Skip to main content

Generate API clients by parsing Swagger definitions

Project description

Swagger codegen for Python


pip install swagger-codegen

Usage example

# Generate Petstore Api client using 'petstore' package name.
swagger_codegen generate petstore


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=""))
>>> 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

Download files

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

Files for swagger-codegen, version 0.1.10
Filename, size File type Python version Upload date Hashes
Filename, size swagger_codegen-0.1.10-py3-none-any.whl (24.5 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size swagger-codegen-0.1.10.tar.gz (15.0 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page