解决Python requests 报错方法集锦
python版本和ssl版本都会导致 requests在请求https网站时候会出一些错误,最好使用新版本。 1 Python2.6x use requests 一台老Centos机器上跑着古老的应用,加了一个新模块之后报错 报错 InsecurePlatformWarning: A true SSLContext object is not available. /usr/lib/python2.6/site-packages/requests/packages/urllib3/util/ssl_.py:132: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information,see https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings 解决办法 使用老版本的 requests $pip install requests==2.5.3 或者这样安装 $ pip install requests[security] 2 SSL3_GET_SERVER_CERTIFICATE:certificate verify failed 错误如下 版本 python2.7.5 Traceback (most recent call last): 解决方法 可以禁用 verify >>> requests.get('https://google.com',verify=True) 3 SSLError: bad handshake SSLError: bad handshake: Error([(‘SSL routines',‘SSL3_GET_SERVER_CERTIFICATE',‘certificate verify failed')],) python2.7.5 讨论参见: https://github.com/rackspace/pyrax/issues/601 以上所述是小编给大家介绍的Python requests 报错方法集锦,希望对大家有所帮助,如果大家有任何疑问欢迎给我留言,小编会及时回复大家的! 您可能感兴趣的文章:
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |