700字范文,内容丰富有趣,生活中的好帮手!
700字范文 > python构造get请求authorization中带bearer token

python构造get请求authorization中带bearer token

时间:2018-11-02 14:15:15

相关推荐

python构造get请求authorization中带bearer token

get请求在postman中使用的时候,authorization中带bearer token,那么使用Python构造get请求时,该token应该怎么带入呢?

解决方法如下:

url_user = ""cookies_user = { 'id':'123455566' }#header值中加一下token#第一种方法headers = { 'Authorization': 'Basic {}'.format(token值) }#第二种方法headers = {"Authorization":"Bearer "+token值}response_user = requests.get(url_user, cookies_user,headers = headers)

试一下就可以了

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。