Python requests.packages.urllib3.connection.VerifiedHTTPSConnection [Errno 11004]

问题描述 投票:2回答:1

所以我对代理很不熟悉,但似乎对它们有一个问题。我看到了许多类似的看似问题,但却无法做出回应的正面或反面。

我写了一些Python(3.4.3)代码,使用请求模块迭代地从https://站点下载一堆excel文件(我称之为https_url,因为它很长)

requests.get(https_url)

每当我在我自己的工作笔记本电脑或家里的电脑上运行代码时它工作正常,但如果其他人在工作中尝试使用它,他们会得到以下内容:

HTTPSConnectionPool(host='secure.conservation.ca.gov', port=443): Max retries exceeded with url: https_url (Caused by NewConnectionError('<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x000000000A8EE390>: Failed to establish a new connection: [Errno 11004] getaddrinfo failed',))

在此之后我尝试使用get而不进行验证:

requests.get(https_url, verify=False)

再无济于事。在我的机器上工作,但没有其他人的。

通过阅读其他答案,我尝试了另外两件事:

1)从诸如certifi之类的地方复制大约十几个不同的.pem文件,并引用requests.get(https_url, verify=xyz.pem)这些文件再次在我的机器上工作(工作+家庭),但不是别人的。

2)下载我的wpad.dat,并引用我认为该文件中包含的代理服务器:requests.get(https_url, proxies={'https': proxy_host:proxy_port}),我在所有机器上获得以下内容:

HTTPSConnectionPool(host='secure.conservation.ca.gov', port=443): Max retries exceeded with url: https_url (Caused by ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 407 Proxy Authentication Required ( Forefront TMG requires authorization to fulfill the request. Access to the Web Proxy filter is denied. )',)))

我不知道下一步该尝试什么。我不明白是什么原因导致它在我的计算机上正常工作,但没有其他人在工作。当然,如果存在代理问题,它也会影响我的笔记本电脑吗?有什么想法吗?

谢谢!

python https proxy ssl-certificate python-requests
1个回答
3
投票

解决这个问题的方法是从URL字符串中删除“https://”。我试图使用f5 SDK,要求:

x = BigIP('url', user, pass)

首先我试过:

x = BigIP(https://example.url.com, user, pass)

我得到了与你所描述的类似的错误,为了解决它,我做了:

x = BigIP(example.url.com, user, pass)

希望这可以帮助。

© www.soinside.com 2019 - 2024. All rights reserved.