authorization-header

Python requests: POST request dropping Authorization header

梦想的初衷 提交于 2020-06-10 12:12:23
问题 I'm trying to make an API POST request using the Python requests library. I am passing through an Authorization header but when I try debugging, I can see that the header is being dropped. I have no idea what's going on. Here's my code: access_token = get_access_token() bearer_token = base64.b64encode(bytes("'Bearer {}'".format(access_token)), 'utf-8') headers = {'Content-Type': 'application/json', 'Authorization': bearer_token} data = '{"FirstName" : "Jane", "LastName" : "Smith"}' response =

Python requests: POST request dropping Authorization header

风流意气都作罢 提交于 2020-06-10 12:12:10
问题 I'm trying to make an API POST request using the Python requests library. I am passing through an Authorization header but when I try debugging, I can see that the header is being dropped. I have no idea what's going on. Here's my code: access_token = get_access_token() bearer_token = base64.b64encode(bytes("'Bearer {}'".format(access_token)), 'utf-8') headers = {'Content-Type': 'application/json', 'Authorization': bearer_token} data = '{"FirstName" : "Jane", "LastName" : "Smith"}' response =