如何通过 HTTP 认证访问 datahug API?

How to access datahug API via HTTP Authentication?

Datahug's documentation 中,它指出 'Authentication is performed using HTTP Basic Authentication - A Datahug username and password will be required in order to access the API.'

因此,我尝试了以下操作(定义了我的用户名和密码)

import requests
from requests.auth import HTTPBasicAuth

url = 'https://api.datahug.com/Contact/'
l = requests.get(url,auth=HTTPBasicAuth(username,password)

但我收到以下错误:

<Response [401]>

我是不是做错了什么?

我还尝试了以下方法:

import requests
from requests.auth import HTTPBasicAuth

url = "https://api.datahug.com/Contact/test@test.com"
l = requests.get(url,auth=(username,password))

我已将问题追溯到您的帐户配置到的 Datahug 版本。 CRM Only 目前不允许 API 访问。我已将帐户版本更改为 Full,这样您还可以访问网络应用程序,并且您还可以拨打 api 电话。

您现在在拨打 API 电话时应该会收到有效回复。