Someone help me this issue.
(有人帮我解决这个问题。)
This is my code:
(这是我的代码:)
import requests
API key correct (API密钥正确)
api_key = c87cabcf1b479b807a7b3ba8xxxxxxxxxxxxxx
headers = {
'Accept': 'application/json',
'Content-Type': 'application/json',
'Authorization': 'Token token=api_key'}
Getting List of serves from this api (从此api获取服务列表)
r = requests.get('https://myserver/api/v1.1/server/', headers = headers, verify=False)
print(r.json())
print (r.status_code)
I am getting error. (我出错了。)I checked my token correct one and not expires. (我检查了我的令牌是否正确,并且没有过期。)
r.json() : {'error': {'code': 'error', 'description': 'Authentication credentials were not provided.'}}
(r.json(): {'错误':{'代码':'错误','描述':'未提供身份验证凭据。'}})
r.status_code : 401
(状态码: 401)
I missed somewhere in header.
(我错过了标题中的某处。)
Please help me on this. (请帮我。)
ask by Murugesan Madappan translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…