简体   繁体   English

如何通过HTTP身份验证访问datahug API?

[英]How to access datahug API via HTTP Authentication?

In Datahug's documentation , it states, 'Authentication is performed using HTTP Basic Authentication - A Datahug username and password will be required in order to access the API.' Datahug的文档中 ,它指出:“身份验证是使用HTTP基本身份验证执行的-需要Datahug用户名和密码才能访问API。”

As a result, I've tried the below (with my username and password defined) 结果,我尝试了以下操作(定义了用户名和密码)

import requests
from requests.auth import HTTPBasicAuth

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

But I receive the following error: 但是我收到以下错误:

<Response [401]>

Am I doing something wrong here? 我在这里做错什么了吗?

I've also tried the following: 我也尝试了以下方法:

import requests
from requests.auth import HTTPBasicAuth

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

I've tracked the issue down to the Datahug Edition your account was configured to. 我已将问题追溯到您的帐户配置为的Datahug版本。 It was CRM Only which at the moment doesn't allow API access. CRM Only ,目前不允许API访问。 I've changed the account Edition to Full which will also give you access to the web app and you will also be able to make api calls. 我已将帐户Edition更改为Full ,这也使您可以访问该网络应用,并且还可以进行api调用。

You should now get a valid response when you make API calls. 现在,当您进行API调用时,您应该会得到一个有效的响应。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何通过扭曲框架通过基本的HTTP身份验证发送HTTP请求 - How to send http request with basic http authentication via twisted framework 使用 API 访问密钥通过 Python 脚本执行的身份验证 - Authentication performed via Python script using an API access key 如何通过HTTP API控制Python GUI - How to control a Python GUI via HTTP API 如何使用 Python 通过 Strava API 访问身份验证? - How to access authentication by Strava API using Python? 如何使用 Python 中的身份验证类型“API 密钥”访问 API 数据? - How to access API data using authentication type 'API key' in Python? Python 如何使用 Z293C9EA246FF99889DC6F62A650FZ 从 Luno.com 查询 API - Python How to Query API from Luno.com with HTTP Authentication 如何通过python中的请求访问github API? - How to access the github API via requests in python? 如何使用 http.client for API 应用带有身份验证的代理 - How to apply proxy with authentication using http.client for API Elasticsearch 服务与 Cognito — 如何通过 Python HTTP 请求访问 - Elasticsearch Service with Cognito — how to access via Python HTTP request 通过代理进行身份验证的urllib2 http请求 - urllib2 http request with authentication via proxy
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM