运行示例代码,返回401
ygr9911 发布于2021-06 浏览:997 回复:1
0
收藏

# encoding:utf-8
import requests

# client_id 为官网获取的AK, client_secret 为官网获取的SK
host = 'https://aip.baidubce.com/oauth/2.0/token?grant_type=client_credentials&client_id=6KulRtIlom7DZcILvo4DFMpx&client_secret=OvGWpQ7TlOiDzF4MYnPlXhDiQFoAeV7'
response = requests.get(host)
print(response)
if response:
print(response.json())

运行标准文档的例子,打印response的结果为Response [401]

收藏
点赞
0
个赞
共1条回复 最后由ghjgfghghg回复于2022-12
#2ygr9911回复于2021-06

原因找到了,SK拷贝有点问题,它有两行,结果我只拷贝了一行。

0
TOP
切换版块