import requests
apiUrl = 'https://openapi.baidu.com/oauth/2.0/token'
data = {
'grant_type':'client_credentials', # 固定值
'client_id':'qVW92fzaxgwFc9x7I', # API Key
'client_secret':'a3xVewVxxnVgdlj94q', # Secret Key
}
try:
r = requests.get(apiUrl, params = data).json()
print(r.get("access_token"))
except Exception as e:
print(e)
创建应用应该都会,百度的文档有时候不写怎么鉴权,上来就是从鉴权之后做
最后打印出来的东西就是鉴权,一串长相奇特的字符串