Skip to main content

swagger_ui_bundle - swagger-ui files in a pip package

Project description

swagger_ui_bundle

This package contains the static files for swagger-ui as a python package.

Basic configuration options are templated with the Jinja2 templating language.

This package is intended to be webserver-agnostic, so it only includes the static files, and some very basic configuration.

Getting Started

You can import the swagger_ui_path from the swagger_ui_bundle package like so:

from swagger_ui_bundle import swagger_ui_path

# or if you need a specific version
from swagger_ui_bundle import swagger_ui_2_path
from swagger_ui_bundle import swagger_ui_3_path

You can easily serve up this directory as all static files to get the default swagger-ui distribution. Here’s an example in flask:

from swagger_ui_bundle import swagger_ui_path

from flask import Flask, Blueprint, send_from_directory, render_template

swagger_bp = Blueprint(
    'swagger_ui',
    __name__,
    static_url_path='',
    static_folder=swagger_ui_path,
    template_folder=swagger_ui_path
)

app = Flask(__name__, static_url_path='')
app.register_blueprint(swagger_bp, url_prefix='/ui')

if __name__ == "__main__":
    app.run()

You may wish to override some of the configuration variables. Included is a jinaj2 templated file where you can modify these parameters. You can add another route to render this template with your desired configuration like so:

SWAGGER_UI_CONFIG = {
    "openapi_spec_url": "https://petstore.swagger.io/v2/swagger.json"
}

@swagger_bp.route('/')
def swagger_ui_index():
    return render_template('index.j2', **SWAGGER_UI_CONFIG)

Have a look at example.py for a complete server for the Flask webserver.

License

Since this is just repackaging swagger-ui releases, the license comes from the swagger ui project (https://github.com/swagger-api/swagger-ui).

All vendored code is published by SmartBear Software under the Apache 2.0 License.

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

swagger_ui_bundle-0.0.3.tar.gz (3.3 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

swagger_ui_bundle-0.0.3-py3-none-any.whl (3.4 MB view details)

Uploaded Python 3

swagger_ui_bundle-0.0.3-py2-none-any.whl (3.4 MB view details)

Uploaded Python 2

File details

Details for the file swagger_ui_bundle-0.0.3.tar.gz.

File metadata

  • Download URL: swagger_ui_bundle-0.0.3.tar.gz
  • Upload date:
  • Size: 3.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.29.1 CPython/3.6.3

File hashes

Hashes for swagger_ui_bundle-0.0.3.tar.gz
Algorithm Hash digest
SHA256 0009f3cb6e60b36a57a595eabbff79ecb364c44e0cdf718667d90a93265f2cf2
MD5 65cd017203c21b05939d9f947bd7dbea
BLAKE2b-256 66a4ac052cd5e0284363bab158dc6b9a4ebb26044c3ae0643a1d20b6797f9412

See more details on using hashes here.

File details

Details for the file swagger_ui_bundle-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: swagger_ui_bundle-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 3.4 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.29.1 CPython/3.6.3

File hashes

Hashes for swagger_ui_bundle-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 c7947ebf03632426b64082f85cb9857e42d4a57075ee962be6f0ec6f32ffe8ec
MD5 25aaf2b9919483dcf41bdd3ea5277839
BLAKE2b-256 0ebbd00f72e512784af20e368d2ecd5868c51a5aa3688d26ace5f4391651a3ce

See more details on using hashes here.

File details

Details for the file swagger_ui_bundle-0.0.3-py2-none-any.whl.

File metadata

  • Download URL: swagger_ui_bundle-0.0.3-py2-none-any.whl
  • Upload date:
  • Size: 3.4 MB
  • Tags: Python 2
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.29.1 CPython/2.7.14

File hashes

Hashes for swagger_ui_bundle-0.0.3-py2-none-any.whl
Algorithm Hash digest
SHA256 ce6a4f9af1e38ce2e5eace4cc3d4805aa05ea40881b7b57b1efab8c1d2bf3afd
MD5 71c8291e74aee8597dad4e166c4be9e6
BLAKE2b-256 3f3a57a06cf6e204c0e9ec760b4fe58af46a8288a7472b85fd8be86c37dc6703

See more details on using hashes here.

Supported by

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