【发布时间】:2020-07-06 21:00:24
【问题描述】:
我正在尝试调用 CRM 套件 api,但它只是返回 401。
{"error":"access_denied","message":"The resource owner or authorization server denied the request.","hint":"Missing \\"Authorization\\" header"}
这就是我在 python 中调用 API 的方式
import requests
url = "https://crm.unlokdevelopment.com/api/access_token"
payload = "{"client_credentials":"client_credentials",\n"client_id":****** ",\n"client_secret":"******"}" print(payload)
headers = { 'Content-Type': 'application/vnd.api+json', 'Accept': 'application/vnd.api+json' }
print(headers)
response = requests.request("POST", url, headers=headers, data=payload)
print(response)
print(response.text.encode('utf8'))
请告诉我我做错了什么。我也尝试过邮递员,但没有运气。 我确认凭据正确
【问题讨论】:
标签: python api http-status-code-401 suitecrm