Reputation: 49
I am trying to pass header in post method for generating access token. however I am getting the wrror about invalid syntax. my header code is as below
headers=("Authorization: Basic RXadsdsdsdsdsdsdsdsdjkfhsuidhsuihf==","Content-Type: application/x-www-form-urlencoded")
headers=('Authorization': 'Basic RXadsdsdsdsdsdsdsdsdjkfhsuidhsuihf==','Content-Type': 'application/x-www-form-urlencoded')
Upvotes: 0
Views: 291
Reputation: 55
You can try the below code:
auth_token = "Basic {}".format(token)
headers = {'Content-Type': 'application/json', 'Authorization': auth_token}
Upvotes: 1
Reputation: 925
Assuming that you are using Requests
, headers should be a dictionary, so:
headers={
"Authorization": "Basic RXadsdsdsdsdsdsdsdsdjkfhsuidhsuihf==",
"Content-Type": "application/x-www-form-urlencoded"
}
Upvotes: 1