我有一个使用eloqua API的程序,我正在尝试使用请求发出get请求。我收到以下错误:
requests.exceptions.ConnectionError:
HTTPSConnectionPool(host='secure.p01.eloqua.comhttps', port=443): Max
retries exceeded with url:
//secure.p01.eloqua.com/API/REST/2.0/assets/importedFile/4482?
depth=complete&xsrfToken=[token]&extensions=e10 (Caused by
NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection
object at 0x104a44150>: Failed to establish a new connection: [Errno
8] nodename nor servname provided, or not known',))
以下是请求的代码:
url = self.e.base_url + "/API/REST/2.0/assets/importedFile/" + js_file_id + "?depth=complete&xsrfToken=[token]&extensions=e10"
try:
request = self.e.raw_request(url, 'get');
print request
self.e.delete_imported_file(js_file_id)
except Exception as e:
self.save_properties()
raise e
self.e.raw_request
指的是以下方法:
def raw_request(self, path, http_method, params=None, payload=None):
"""Does a raw eloqua request given a path, params, and payload"""
url = self.base_url + path
if http_method.lower() == 'get':
response = requests.get(url, auth=self.auth, params=params)
elif http_method.lower() == 'post':
response = requests.post(url, auth=self.auth, json=payload)
elif http_method.lower() == 'put':
response = requests.put(url, auth=self.auth, json=payload)
elif http_method.lower() == 'delete':
response = requests.put(url, auth=self.auth, params=params)
else:
raise self.InvalidRequestError
return response
raw_request
方法在代码中的其他位置工作,我不确定我在请求中做错了什么。