Python requests library how to pass Authorization header with single token
In python: (‘<MY_TOKEN>’) is equivalent to ‘<MY_TOKEN>’ And requests interprets (‘TOK’, ‘<MY_TOKEN>’) As you wanting requests to use Basic Authentication and craft an authorization header like so: ‘VE9LOjxNWV9UT0tFTj4K’ Which is the base64 representation of ‘TOK:<MY_TOKEN>’ To pass your own header you pass in a dictionary like so: r = requests.get(‘<MY_URI>’, headers={‘Authorization’: ‘TOK:<MY_TOKEN>’})