Skip to main content

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


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

Uploaded Source

Built Distribution

swagger_codegen-0.1.8-py3-none-any.whl (24.5 kB view details)

Uploaded Python 3

File details

Details for the file swagger-codegen-0.1.8.tar.gz.

File metadata

  • Download URL: swagger-codegen-0.1.8.tar.gz
  • Upload date:
  • Size: 15.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.5 CPython/3.8.1 Darwin/19.4.0

File hashes

Hashes for swagger-codegen-0.1.8.tar.gz
Algorithm Hash digest
SHA256 0c7a2ed24ae87c887b01841037939c0ca7c5285495ed7992dcdceba9e3f44004
MD5 4ff180f597377df7ace9016ae5263f35
BLAKE2b-256 8d3cf02271403db942bf7ba99c58da7b7f9ae4bfc6f845d58c4e316b151a7524

See more details on using hashes here.

File details

Details for the file swagger_codegen-0.1.8-py3-none-any.whl.

File metadata

  • Download URL: swagger_codegen-0.1.8-py3-none-any.whl
  • Upload date:
  • Size: 24.5 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

Hashes for swagger_codegen-0.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 16c26a60f084d26924a2096f6b9f9ab97924273e76c8c427d6a15634c3a0b1be
MD5 56aff8c991762b774a3296f3aba35dc7
BLAKE2b-256 6c35eff3b37f64f602bdafe2f667b40ccd16a8e1018717bc7a7ca09d6e577ee3

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