我正在尝试向特定api发出GET请求
import requests
import json
access_token = "71e89e8af02206575b3b4ae80bf35b6386fe3085af3d4085cbc7b43505084482"
url_base = "https://api.huntflow.ru/"
headers = {
'User-Agent': 'App/1.0',
'Host': 'api.huntflow.ru',
'Content-Type': 'application/json',
'Accept': '*/*',
'Authorization': 'Bearer {0}'.format(access_token)
}
def test():
url = '{0}me'.format(url_base)
response = requests.get(url, headers=headers)
if response.status_code == 200:
return json.loads(response.content.decode('utf-8'))
else:
return response.json()
print(test())
输出: {'errors':[{'type':'oauth','value':['bad_authorization']}],'description':'Invalid access token'}
怎么了,告诉我
目前没有回答
相关问题 更多 >
编程相关推荐