• python爬虫时遇到proxyError (SSLError/_ssl.c:1076)的解决方法


    电脑安装了selenium和chromedriver后,爬虫的加上proxies后就无法请求:

    requests.exceptions.ProxyError: HTTPSConnectionPool(host='www.baidu.com', port=443): Max retries exceeded with url: / (Caused by ProxyError('Your proxy appears to only use HTTP and not HTTPS, try changing your proxy URL to be HTTP. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#https-proxy-error-http-proxy', SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1076)'))))

    网上收集了一些原因,包括是否开启了抓包工具、端口是否被占用、pyopenssl版本问题。

    但我这里的解决方法是降低urllib的版本到1.23 。降低后就正常了。

    这中间,实在没办法的临时方法是:把proxies写成 {‘http’:'xxxxxx'} ,不添加https也是可以继续爬的,但这样并不是完美的解决方案。

  • 相关阅读:
    分页,上传,下载
    java web 开发模式
    EL/JSTL-jsp页面更简单的输出方式
    过滤器和监听器
    Servlet
    jsp标准动作
    java Bean
    寻找你的热情(1)——检查自己所处的位置
    fedora25 安装sublime text3
    python实例3-天气小模块
  • 原文地址:https://www.cnblogs.com/lishanyang/p/16279016.html
Copyright © 2020-2023  润新知