Python Requests Error Resolution Collection

Source: Internet
Author: User

Both the Python version and the SSL version will cause requests to make some mistakes when requesting HTTPS sites, preferably with a new version.

1 python2.6x Use Requests

An old CentOS machine running on an old application, adding a new module after the error error 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  insecureplatformwarning  

Solutions
Using the old version of requests

$pip install requests==2.5.3

Or install it like this

$ pip install requests[security]
2 SSL3_GET_SERVER_CERTIFICATE: Certificate Verify failed

Error following version python2.7.5

Traceback (most Recent Call last): File"./test.py", line  -,inch<module> response = Requests.Get(url1, Headers=headers) File"build/bdist.linux-x86_64/egg/requests/api.py", line  the,inch GetFile"build/bdist.linux-x86_64/egg/requests/api.py", line  +,inchRequest File"build/bdist.linux-x86_64/egg/requests/sessions.py", line 209,inchRequest File"build/bdist.linux-x86_64/egg/requests/models.py", line 624,inch SendFile"build/bdist.linux-x86_64/egg/requests/models.py", line  -,inch _build_response File"build/bdist.linux-x86_64/egg/requests/models.py", line 611,inch SendRequests.exceptions.SSLError: [Errno1]_sslC503: error:14090086: SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate Verify failed

Workaround
You can disable verify

>>> requests.get(‘https://google.com‘, verify=True)

Problem Address Python-requests-throwing-up-sslerror

3 Sslerror:bad Handshake

Sslerror:bad handshake:error ([' SSL routines ', ' ssl3_get_server_certificate ', ' CERTIFICATE verify failed ')] python2.7.5

pip uninstall -y certifi && pip install certifi==2015.04.28

discussion See Also: https://github.com/rackspace/pyrax/issues/601

Python Requests Error Resolution Collection

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.