Skip to main content

Swagger UI blueprint for Flask

Project description

flask-swagger-ui

Simple Flask blueprint for adding Swagger UI to your flask application.

Included Swagger UI version: 4.11.1.

Installation

pip install flask-swagger-ui

Usage

Example application:

from flask import Flask
from flask_swagger_ui import get_swaggerui_blueprint

app = Flask(__name__)


SWAGGER_URL = '/api/docs'  # URL for exposing Swagger UI (without trailing '/')
API_URL = 'http://petstore.swagger.io/v2/swagger.json'  # Our API url (can of course be a local resource)

# Call factory function to create our blueprint
swaggerui_blueprint = get_swaggerui_blueprint(
    SWAGGER_URL,  # Swagger UI static files will be mapped to '{SWAGGER_URL}/dist/'
    API_URL,
    config={  # Swagger UI config overrides
        'app_name': "Test application"
    },
    # oauth_config={  # OAuth config. See https://github.com/swagger-api/swagger-ui#oauth2-configuration .
    #    'clientId': "your-client-id",
    #    'clientSecret': "your-client-secret-if-required",
    #    'realm': "your-realms",
    #    'appName': "your-app-name",
    #    'scopeSeparator': " ",
    #    'additionalQueryStringParams': {'test': "hello"}
    # }
)

app.register_blueprint(swaggerui_blueprint)

app.run()

# Now point your browser to localhost:5000/api/docs/

Configuration

The blueprint supports overloading all Swagger UI configuration options that can be JSON serialized. See https://github.com/swagger-api/swagger-ui#parameters for options.

Plugins and function parameters are not supported at this time.

OAuth2 parameters can be found at https://github.com/swagger-api/swagger-ui#oauth2-configuration .

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

flask-swagger-ui-4.11.1.tar.gz (1.4 MB view details)

Uploaded Source

Built Distribution

flask_swagger_ui-4.11.1-py3-none-any.whl (1.4 MB view details)

Uploaded Python 3

File details

Details for the file flask-swagger-ui-4.11.1.tar.gz.

File metadata

  • Download URL: flask-swagger-ui-4.11.1.tar.gz
  • Upload date:
  • Size: 1.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.8.10

File hashes

Hashes for flask-swagger-ui-4.11.1.tar.gz
Algorithm Hash digest
SHA256 a370199a780d678b32e38f1be10d4d81efa0ee63e9fe2fb766ff1a4b6c37dac8
MD5 24cdbf024de1d2c6877f16ca2abfe62b
BLAKE2b-256 6c80c53f1d3758b07d4a0c86e03ce97097382e7e559ccb25d959bbaf3d17ddca

See more details on using hashes here.

File details

Details for the file flask_swagger_ui-4.11.1-py3-none-any.whl.

File metadata

File hashes

Hashes for flask_swagger_ui-4.11.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c951928fe4592d3561b543e0e1ca32703f55d3474de86c894a9d27f795d96c83
MD5 4326f2edd7e44f31911ee663576cf4b1
BLAKE2b-256 a520df137e8efb744209135f70cb2b00c8917369ae4177370d1fab1789a0675c

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