使用请求modu的url超过最大重试次数

2024-03-29 08:18:22 发布

您现在位置:Python中文网/ 问答频道 /正文

我有一个程序正在使用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',))

以下是请求的代码:

^{pr2}$

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方法在代码的其他地方工作,我不确定我的请求有什么地方做错了。在


Tags: pathselfauthhttpurlgetrawresponse