我只需要输出访问令牌:[xxxxx] oauth 你能帮我吗?
代码:
import requests
url = "xxxxy/v3/oauth2/token"
payload = {
"grant_type": "client_credentials",
"client_id": "xxxxx",
"client_secret": "xxxxx"
}
headers = {
"Accept": "application/json",
"Content-Type": "application/json"
}
response = requests.request("POST", url, json=payload, headers=headers)
print(response.text)
输出: 在输出中,我们可以看到 access_token、令牌类型和此密钥的到期时间。 我只想输出来自“access_token”的代码。
{
"access_token":"xxxxxxxxxxxxxxxxxxxxxxxxxxx"
"token_type":"bearer"
"expires_in":3600
}