我使用请求从第三方门户中提取一些JSON。
每当我使用请求时,我都会得到一个'{"Message":"Path not found"}'
错误
但是,使用cURL运行命令可以正常工作。下面是cURL命令:
curl https://blah.com/api/v1/nodes --header 'Authorization: Bearer my-long-token-base64'
我正在尝试用python3/请求执行此操作:
#convert token to base64
base64_token = base64.b64encode(bytes(access_token, 'utf-8'))
#convert to str
base64_token = base64_token.decode("utf-8")
api = 'https://blah.com/api/v1/nodes'
headers = {'Authorization': 'Bearer ' + base64_token,
'Accept': 'application/json'}
nodes = requests.post(api, headers=headers)
每当我运行这个时,响应都是'{"Message":"Path not found"}'
我认为这可能与base64令牌有关(这是必需的),但我很肯定我已经正确地得到了这部分,因为否则我会得到401。你知道吗
有什么想法吗?你知道吗
目前没有回答
相关问题 更多 >
编程相关推荐