Answers for "how to add auth bearer with python requests"

4

add bearer token in python request

import requests

auth_token='sdfghjkloerdtfyguhiopfghjkl;fghjkl'
hed = {'Authorization': 'Bearer ' + auth_token}
data = {'app' : 'aaaaa'}

url = 'https://api.xy.com'
response = requests.post(url, json=data, headers=hed)
print(response)
print(response.json())
Posted by: Guest on January-16-2021
0

python requests pass auth token

>>> import requests
>>> response = requests.get('https://website.com/id', headers={'Authorization': 'access_token myToken'})
or 
>>> response = requests.get('https://api.buildkite.com/v2/organizations/orgName/pipelines/pipelineName/builds/1230', headers={ 'Authorization': 'Bearer <your_token>' })
Posted by: Guest on June-30-2021

Code answers related to "how to add auth bearer with python requests"

Python Answers by Framework

Browse Popular Code Answers by Language