zoukankan      html  css  js  c++  java
  • python使用requests时报错requests.exceptions.SSLError: HTTPSConnectionPool

    requests.exceptions.SSLError: HTTPSConnectionPool(host='www.baidu.com', port=443): Max retries exceeded with url: / (Caused by SSLError(SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:581)'),))  

     
    错误提示就是上面这样的。首先我找了很多的资料,有很多人说关闭证书验证(verify=False))可以解决这个问题或者说是在进行GET时,指定SSL证书.
    response = requests.get('http://www.baidu.com/', headers = header, verify=False)  
    但我用以上两种方法都没有完美解决此问题,而且有些还有后续错误比如InsecureRequestWarning

     

    正确的做法参考文档资料

    https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings

    https://urllib3.readthedocs.io/en/latest/user-guide.html#ssl

    参考博客:http://blog.csdn.net/zahuopuboss/article/details/52964809

     

    只要安装一下几个requests依赖包就可以解决此问题

    pip install cryptography 

    pip install pyOpenSSL

    pip install certifi

    原文转至博客:https://blog.csdn.net/qq_31077649/article/details/79013199

  • 相关阅读:
    oracle 索引
    oracle 子查询因子化 浅谈(with的使用)
    大数据的遐想
    数据挖掘(算法概要链接)
    orcale 修改字段属性
    sql 对一张表进行按照不同条件进行多次统计
    oracle dblink
    oracle作业
    SQL效率的几点心得
    提高SQL语句的性能
  • 原文地址:https://www.cnblogs.com/hum0ro/p/9536033.html
Copyright © 2011-2022 走看看