【问题标题】:HTTPS using a proxy server with requests python 3.xHTTPS 使用代理服务器请求 python 3.x
【发布时间】:2021-09-11 08:14:47
【问题描述】:

我想要使用代理的请求,但出现以下错误。

requests.exceptions.ProxyError: HTTPSConnectionPool(host='URL', port=443): Max retries exceeded with url: / (Caused by ProxyError('Cannot connect to proxy.', FileNotFoundError(2, 'No such file or directory')))

我尝试将 urllib3 的版本降级到 1.25.3,即使我尝试了如下代理设置,同样的错误仍然存​​在。

proxies = [{
    'http' : 'http://ip:port',
    'https' : 'http://ip:port'
}]

&&&&&

proxies = [{
    'http' : 'http://ip:port',
    'https' : 'https://ip:port'
}]

验证选项也被赋予了错误值,但错误继续发生。你能告诉我解决办法吗?

我搜的时候听说我的代理ip不支持https通信。是这样吗?

【问题讨论】:

    标签: python python-3.x web-scraping proxy python-requests


    【解决方案1】:
    proxies = {
            'http': 'http://user_name:password@ip:port',
            'https': 'http://user_name:password@ip:port'
        }
    r = requests.get(URL, proxies=proxies)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-12-21
      • 2022-01-13
      • 1970-01-01
      • 2020-05-03
      • 1970-01-01
      • 2018-02-23
      • 2022-08-02
      相关资源
      最近更新 更多