Resolve Python requests error reporting method highlights

  • 2020-05-27 06:03:35
  • OfStack

Both the python and ssl versions cause requests to make some errors when requesting the https site. It is best to use the new version.

1 Python2.6x use requests

1 old Centos machine running the old application, add a new module and report error: InsecurePlatformWarning: A true SSLContext object is not available.

/usr/lib/python2.6/site-packages/requests/packages/urllib3/util/ 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

The solution

Use the older 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

The error is as follows: version python 2.7.5

Traceback (most recent call last):
File "./", line 24, in < module >
response = requests.get(url1, headers=headers)
File "build/bdist.linux-x86_64/egg/requests/", line 52, in get
File "build/bdist.linux-x86_64/egg/requests/", line 40, in request
File "build/bdist.linux-x86_64/egg/requests/", line 209, in request
File "build/bdist.linux-x86_64/egg/requests/", line 624, in send
File "build/bdist.linux-x86_64/egg/requests/", line 300, in _build_response
File "build/bdist.linux-x86_64/egg/requests/", line 611, in send
requests.exceptions.SSLError: [Errno 1] _ssl.c:503: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed

The solution

You can disable verify

> > > requests.get('', verify=True)
The problem address is 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

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

The above is the site for you to introduce Python requests error reporting method collection, I hope to help you, if you have any questions welcome to give me a message, this site will timely reply to you!

Related articles: