Reputation: 31
I have this code which doesn't work, and keeps getting me this error:
TypeError: 'EnvironHeaders' object is not callable
The Code is:
@app.route('/auth', methods=['GET'])
def auth():
return request.headers.get('x-authorization')
As my code explains, am i trying to get the header called: x-authorization, from an incoming request. It is a STS token that is coming in. Im using flask and importet request from flask
Upvotes: 2
Views: 3037
Reputation: 11
Headers in flask, request.headers.get is a dictionary. Hence it is supposed to be accessed as request.headers['x-authorization']
Using curly braces makes it a function call like foo()
.
You need to use []
instead of ()
Upvotes: 1