Skip to main content

SwaggerUI blueprint for Flask

Project description

# flask-swagger-ui

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

Included Swagger UI version: 2.2.5.

## Installation

`pip install flask-swagger-ui`

## Usage

Example application:

from flask import Flask
from swagger_ui import get_swaggerui_blueprint

app = Flask(__name__)

SWAGGER_URL = '/api/docs' # URL for exposing Swagger UI (without trailing '/')
API_URL = '' # 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/'
config={ # Swagger UI config overrides
'supportedSubmitMethods': ['get']

# Register blueprint at URL
# (URL must match the one given to factory function above)
app.register_blueprint(swaggerui_blueprint, url_prefix=SWAGGER_URL)

# 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 for options.

In addition, some of the OAuth fields are exposed to special variables that will be rendered into the relevant function.

Blueprint defaults are listed below (should match SwaggerUI defaults).

# OAuth related
'app_name': 'null',
'client_realm': 'null',
'client_id': 'null',
'client_secret': 'null',

# SwaggerUI base configuration, see
'docExpansion': "none",
'jsonEditor': False,
'defaultModelRendering': 'schema',
'showRequestHeaders': False,
'supportedSubmitMethods': ['get', 'post', 'put', 'delete', 'patch']

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 flask-swagger-ui, version 0.0.1
Filename, size File type Python version Upload date Hashes
Filename, size flask-swagger-ui-0.0.1.tar.gz (946.3 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