Swagger UI for Python web framework, such Tornado, Flask, Quart and Sanic.
Project description
swagger-ui-py
Swagger UI for Python web framework, such Tornado, Flask, Quart, aiohttp and Sanic.
Only support Python3.
Usage
-
Install
pip3 install swagger-ui-py
-
Code
Using the local config file
from swagger_ui import api_doc api_doc(app, config_path='./config/test.yaml', url_prefix='/api/doc', title='API doc')
Using config url, but need to suport CORS
api_doc(app, config_url='https://petstore.swagger.io/v2/swagger.json', url_prefix='/api/doc', title='API doc')
And suport config file editor
api_doc(app, config_path='./config/test.yaml', editor=True)
And keep the old way
# for Tornado from swagger_ui import tornado_api_doc tornado_api_doc(app, config_path='./conf/test.yaml', url_prefix='/api/doc', title='API doc') # for Sanic from swagger_ui import sanic_api_doc sanic_api_doc(app, config_path='./conf/test.yaml', url_prefix='/api/doc', title='API doc') # for Flask from swagger_ui import flask_api_doc flask_api_doc(app, config_path='./conf/test.yaml', url_prefix='/api/doc', title='API doc') # for Quart from swagger_ui import quart_api_doc quart_api_doc(app, config_path='./conf/test.yaml', url_prefix='/api/doc', title='API doc') # for aiohttp from swagger_ui import aiohttp_api_doc aiohttp_api_doc(app, config_path='./conf/test.yaml', url_prefix='/api/doc', title='API doc')
-
Edit
Swaggerconfig file (JSON or YAML)Please see https://swagger.io/resources/open-api/.
-
Access
Open
http://<host>:<port>/api/doc/editor, you can edit api doc config file.Open
http://<host>:<port>/api/docview api doc.
Swagger UI
Swagger UI version is 3.22.0. see https://github.com/swagger-api/swagger-ui.
Swagger Editor
Swagger Editor version is 3.6.27. see https://github.com/swagger-api/swagger-editor.
Update
You can update swagger ui and swagger editor version with
cd swagger-ui-py/tools
python update.py ui
# or
python update.py editor
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file swagger-ui-py-0.1.7.tar.gz.
File metadata
- Download URL: swagger-ui-py-0.1.7.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.18.4 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1042c7295227e155d65a75909cbbc4dfd029bc5f5f405a3726ff5fb2343add54
|
|
| MD5 |
550502484fb65739b411312728108007
|
|
| BLAKE2b-256 |
55e01fe8af4f98e462eb8505ba2fc2d4d678d63ef33b662a9c9fdf8d97d1b4b0
|
File details
Details for the file swagger_ui_py-0.1.7-py3-none-any.whl.
File metadata
- Download URL: swagger_ui_py-0.1.7-py3-none-any.whl
- Upload date:
- Size: 6.8 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.18.4 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8b9f9ffbcfa313c944bf9528abfc8a114befb1429355f4b28bf0c2506f3a275b
|
|
| MD5 |
71e76b07ff551e4308d21530a9f35334
|
|
| BLAKE2b-256 |
31106de5aa74dcb48a8f2f4ad98fd5224dce0bc80921f61fd764a4723ea777ca
|