Git Product home page Git Product logo

swagger-ui-py's Introduction

swagger-ui-py

Swagger UI for Python web framework, such Tornado, Flask, Quart, aiohttp, Sanic and Falcon.

Only support Python3.

Supported

  • tornado
  • flask
  • sanic
  • aiohttp
  • quart
  • starlette
  • falcon
  • bottle

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')
    
    # for Falcon
    from swagger_ui import falcon_api_doc
    falcon_api_doc(app, config_path='./conf/test.yaml', url_prefix='/api/doc', title='API doc')
  • Edit Swagger config 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/doc view api doc.

Swagger UI

Swagger UI version is 3.25.1. see https://github.com/swagger-api/swagger-ui.

Swagger Editor

Swagger Editor version is 3.8.1. 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

swagger-ui-py's People

Contributors

pwzer avatar klaashoekstra94 avatar tamarmot avatar patleg avatar carstencodes avatar pasqlisena avatar sdvallejo avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.