我正在尝试在标题中传递apikey、username、customer\u id,这里可以通过另一种格式进行apikey授权,但无法在标题中传递username、customer\u id
@api.header('X-Consumer-Custom-ID')
@api.header('X-Consumer-Username')
class check(Resource):
@login_required
def post(self):
parser = reqparse.RequestParser()
parser.add_argument('id', type=str, location='form', required=True)
parser.add_argument('X-Consumer-Custom-ID', location='headers')
parser.add_argument('X-Consumer-Username', location='headers')
args = parser.parse_args()
order_id = args['id']
标题中另一种格式的apiKey授权:
authorizations = {
'apikey': {
'type': 'apiKey',
'in': 'header',
'name': 'X-API-KEY'
}}
app = Flask(__name__)
SWAGGER_DOC = True
api = Api(app, authorizations=authorizations, security=['apikey'], version='dev',
title='Awesome Flask APIs',
doc="/" if SWAGGER_DOC is True else False,
description='Awesome RESTful APIs, written in Flask', )
请帮助我,我想通过三个参数,任何想法或建议将不胜感激
目前没有回答
相关问题 更多 >
编程相关推荐