使用Python和Request处理Streak CRM API。取决于我如何说出请求,我得到4XX错误。 (下面的例子)Python API和响应 - 身份验证
response = requests.get('https://www.streak.com/api/v1/pipelines?api-key=xxxxxxxx')
response.headers['Content-Type'] = 'application/json'
print(response.status_code)
print(response.content)
结果:401 “需要验证的条纹API:尝试HTTP基本认证或cookie认证”
如果我的文件路径后加 “以.json”:
requests.get('https://www.streak.com/api/v1/pipelines.json?api-key=xxxxxxxx')
结果:400“指定的API路径无效”因此,我假设我已通过身份验证,但只是具有定义不良的文件路径。
但是,如果使用在终端上输入相同的文件路径和证书:
curl https://www.streak.com/api/v1/pipeline -u xxxxxxxx:
就像一个魅力。
为什么文件路径可以在终端中工作,但不能在python中工作?为什么我需要将.json添加到我的文件路径中?新的使用API,所以任何帮助表示赞赏。谢谢。