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: 5.21.0.

This project is not actively maintained, but might receive occasional updates. Please fork it if you need a newer version.

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/blob/master/docs/usage/configuration.md#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-5.21.0.tar.gz (1.6 MB view details)

Uploaded Source

Built Distribution

flask_swagger_ui-5.21.0-py3-none-any.whl (1.7 MB view details)

Uploaded Python 3

File details

Details for the file flask_swagger_ui-5.21.0.tar.gz.

File metadata

  • Download URL: flask_swagger_ui-5.21.0.tar.gz
  • Upload date:
  • Size: 1.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for flask_swagger_ui-5.21.0.tar.gz
Algorithm Hash digest
SHA256 872d038dc11a68eacab88f6f05be3c533aa300453e273775dad3e029b31e03d4
MD5 94de969dbaff3736882e70af2e1d2ecd
BLAKE2b-256 198cb64b382a061d0c383fdb4c01c4d95b697a5b36a368097108613afae19506

See more details on using hashes here.

Provenance

The following attestation bundles were made for flask_swagger_ui-5.21.0.tar.gz:

Publisher: release.yml on sveint/flask-swagger-ui

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

File hashes

Hashes for flask_swagger_ui-5.21.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5ecff6c284d7c5559f3473bd534a31fa5dfc0022502d63f4a04728c2b10596f6
MD5 cd77e6322a1ffc0386db193814d344a0
BLAKE2b-256 59947cbe53a11c2e36b562320b698605ac642951ac2662e6192f6385e9956955

See more details on using hashes here.

Provenance

The following attestation bundles were made for flask_swagger_ui-5.21.0-py3-none-any.whl:

Publisher: release.yml on sveint/flask-swagger-ui

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page