Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/api/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Calendly API返回一个401_Python_Api_Python Requests_Calendly - Fatal编程技术网

Python Calendly API返回一个401

Python Calendly API返回一个401,python,api,python-requests,calendly,Python,Api,Python Requests,Calendly,我想使用Calendly中用户的请求进行API调用,但我可以做到,我不知道我的代码中是否还需要其他内容,谢谢 import requests, json api_key = 'aaaaaaaaa' header = { 'Authorization' : api_key } response = requests.get('https://api.calendly.com/users/me/', headers= header) print(response) print(respo

我想使用Calendly中用户的请求进行API调用,但我可以做到,我不知道我的代码中是否还需要其他内容,谢谢

import requests, json

api_key = 'aaaaaaaaa'
header = {
    'Authorization' : api_key
}

response = requests.get('https://api.calendly.com/users/me/', headers= header)
print(response)
print(response.json())
我收到了401的回复:

<Response [401]> {'title': 'Unauthenticated', 'message': 'The access token is invalid'}
{'title':'Unauthenticated','message':'访问令牌无效'}

我怀疑您试图使用API v2的API密钥。API密钥仅适用于Calendly的遗留API v1。API v2支持以下两种授权方案:

  • OAuth授权代码流,或
  • 个人访问令牌

有关更多详细信息,请参阅。

您得到的答复是什么?{'title':'Unauthenticated','message':'access token is invalid'}我怀疑您正在使用API v2的API密钥(仅适用于Calendly的旧API v1)。API v2仅适用于OAuth授权流或个人访问令牌。有关更多详细信息,请参阅。