How to get http headers in flask?

后端 未结 4 1628
借酒劲吻你
借酒劲吻你 2020-11-28 23:17

I am newbie to python and using Python Flask and generating REST API service.

I want to check authorization header which is sent the client.

But I can\'t fin

4条回答
  •  伪装坚强ぢ
    2020-11-28 23:58

    If any one's trying to fetch all headers that were passed then just simply use:

    dict(request.headers)
    

    it gives you all the headers in a dict from which you can actually do whatever ops you want to. In my use case I had to forward all headers to another API since the python API was a proxy

提交回复
热议问题