python request with authentication (access_token)

后端 未结 5 2098
别跟我提以往
别跟我提以往 2020-11-28 06:00

I am trying to get an API query into python. The command line

curl --header \"Authorization:access_token myToken\" https://website.com/id

g

5条回答
  •  温柔的废话
    2020-11-28 06:47

    I'll add a bit hint: it seems what you pass as the key value of a header depends on your authorization type, in my case that was PRIVATE-TOKEN

    header = {'PRIVATE-TOKEN': 'my_token'}
    response = requests.get(myUrl, headers=header)
    

提交回复
热议问题