def add_swagger_api_route(app, target_route, swagger_json_route):
    """
    mount a swagger statics page.

    app: the flask app object
    target_route: the path to mount the statics page.
    swagger_json_route: the path where the swagger json definitions is
        expected to be.
    """
    static_root = get_swagger_static_root()
    swagger_body = generate_swagger_html(
        STATIC_ROOT, swagger_json_route
    ).encode("utf-8")

    def swagger_ui():
        return Response(swagger_body, content_type="text/html")

    blueprint = Blueprint('swagger', __name__,
                          static_url_path=STATIC_ROOT,
                          static_folder=static_root)
    app.route(target_route)(swagger_ui)
    app.register_blueprint(blueprint)
def add_swagger_api_route ( app , target_route , swagger_json_route ) : static_root = get_swagger_static_root ( ) swagger_body = generate_swagger_html ( STATIC_ROOT , swagger_json_route ) . encode ( "utf-8" ) def swagger_ui ( ) : return Response ( swagger_body , content_type = "text/html" ) blueprint = Blueprint ( 'swagger' , __name__ , static_url_path = STATIC_ROOT , static_folder = static_root ) app . route ( target_route ) ( swagger_ui ) app . register_blueprint ( blueprint )
mount a swagger statics page.

    app: the flask app object
    target_route: the path to mount the statics page.
    swagger_json_route: the path where the swagger json definitions is
        expected to be.