You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
from flask import Flask, Blueprint
from apispec import APISpec
from apispec.ext.marshmallow import MarshmallowPlugin
from flask_apispec import FlaskApiSpec
def create_app(mode='dev', test_configs=None):
app = Flask(__name__)
app.extensions['mode'] = mode
marshmallow_plugin = MarshmallowPlugin()
# Filter the warnins for partial schemas
warnings.filterwarnings("ignore", message="Multiple schemas resolved to the name ")
authorizations = {
'apikey': {
'type': 'apiKey',
'in': 'header',
'name': 'X-API-KEY'
}
}
app.config.update({
## flask-apispec
'APISPEC_SPEC': APISpec(
title='DeepCT Notifier Server APIs',
version='v1.0.0',
plugins=[marshmallow_plugin],
openapi_version='2.0',
authorizations=authorizations
),
'APISPEC_SWAGGER_UI_URL': '/api-spec', # Define the api spec route
marshmallow_plugin.converter.add_attribute_function(_enum_to_properties) # Support showing enum on Swagger
docs = FlaskApiSpec(app, document_options=False)
return app
and I also tried put authorizations variables at FlaskApiSpec like FlaskApiSpec(app, document_options=False, authorizations=authorizations). but it ended it is unexpected key word.
Does flask-apispec support to get authorized via button a head of the swagger ui page instead of manually set "Authorization" to Bearer in individual endpoint's headers ?
thanks for helping
The text was updated successfully, but these errors were encountered:
@CineXWorm I think that, even though this adds the green Authorize button, it does not add the security header to the request: curl -X GET "http://127.0.0.1:5000/" -H "accept: application/json"
I'm using FlaskApiSpec, but I couldn't make the authorization button appear in swagger ui,
I've tried the following solution but it didn't work,
https://mattfrear.com/2018/07/21/add-an-authorization-header-to-your-swagger-ui-with-swashbuckle-revisited/
here are my config
and I also tried put authorizations variables at FlaskApiSpec like FlaskApiSpec(app, document_options=False, authorizations=authorizations). but it ended it is unexpected key word.
Does flask-apispec support to get authorized via button a head of the swagger ui page instead of manually set "Authorization" to Bearer in individual endpoint's headers ?
thanks for helping
The text was updated successfully, but these errors were encountered: