HTTPS 代理不适用于 Python 请求

时间:2021-01-29 08:58:25

标签: python python-requests python-requests-html

我在 proxies.txt 中获得了代理,并使用 ProxyManager 获得了一个随机代理。我也尝试使用这样的字典:

myProxy = {
    'http' : 'http://username:password@ip:port',
    'https' : 'https://username:password@ip:port',
}

然后是请求

url = "https://www.google,com/"
response = s.request("GET", url, headers=headers, proxies=myProxy)
print(response.text)

但我收到这些错误:

OSError: [Errno 0] Error

During handling of the above exception, another exception occurred:

urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='www.google,com', port=443): Max retries exceeded with url: / (Caused by ProxyError('Cannot connect to proxy.', OSError(0, 'Error')))

相反,如果我请求一个 http 网站,比如我拥有的个人域名,我会得到想要的响应。

0 个答案:

没有答案