Requests module has been normal, before one day began to HTTPS requests the thrown error:
requests. Exceptions. SSLError: [1] Errno _ssl. C: 504: error: 14090086: SSL routines: SSL3_GET_SERVER_CERTIFICATE: certificate verify failed
At first, I thought the agent was unstable and restarting the agent was invalid, then I restarted the machine and it was invalid. Code problems?It is ok to copy the error code to another machine, or to report the certificate error if the code running normally on another machine is copied to the error machine. Just try the requests. Get requests FOR HTTP.
All sorts of solutions have been tried in vain. Search the Internet for answers. I found two solutions: the first One I used. The second one is also backed up.
The first solution:
What is SSL validation?
SSL certificates are SSL protocol compliant, issued by a trusted digital certificate authority (CA) after server authentication, with server authentication and data transmission encryption.
SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
add a new feature in python 2.7 that will validate the SSL certificate when urlopen requests it, or make an error if it is a self-signed SSL certificate.
Python request SSL error
has a verify parameter in both the request-post and request-get methods. Set the verify parameter to FALSE.
r = requests. Get (“xxx.com”, headers=request_headers, verify=False)
print r.tent
The second solution:
Try:
requests. Exceptions. SSLError: [1] Errno _ssl. C: 504: error: 14090086: SSL routines: SSL3_GET_SERVER_CERTIFICATE: certificate verify failed
At first, I thought the agent was unstable and restarting the agent was invalid, then I restarted the machine and it was invalid. Code problems?It is ok to copy the error code to another machine, or to report the certificate error if the code running normally on another machine is copied to the error machine. Just try the requests. Get requests FOR HTTP.
All sorts of solutions have been tried in vain. Search the Internet for answers. I found two solutions: the first One I used. The second one is also backed up.
The first solution:
What is SSL validation?
SSL certificates are SSL protocol compliant, issued by a trusted digital certificate authority (CA) after server authentication, with server authentication and data transmission encryption.
SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
add a new feature in python 2.7 that will validate the SSL certificate when urlopen requests it, or make an error if it is a self-signed SSL certificate.
Python request SSL error
has a verify parameter in both the request-post and request-get methods. Set the verify parameter to FALSE.
r = requests. Get (“xxx.com”, headers=request_headers, verify=False)
print r.tent
The second solution:
Try:
sudo apt-get install ca-certificates
sudo update-ca-certificates
No effect,
finally tried the following one that worked:
sudo pip uninstall -y certifi
sudo pip install certifi==2015.04.28
Of course, there are caveats:
/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/util/ssl_.py:79: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning
No, at least we can use it for now. The reason for this is estimated to be that the Later version (2016.2.8) CertiFI is more certifying.
Read More:
- python3 request module https certificate verify failed error
- ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed
- python:urllib2.URLError urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed
- [SSL: CERTIFICATE_VERIFY_FAILED] Certificate Verify Failed (_ssl.C:579)
- How to Fix SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed.
- URLError: urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:833)
- Spark login error unable to verify certificate and certificate host name verification failed
- Python – SSL certificate error
- SSL handshake failed: SSL error: illegal key usage detected in the certificate
- cURL error 60: SSL certificate problem: self signed certificate in certificate chain
- svn: E230001: Server SSL certificate verification failed: certificate issued
- Idea svn connection https error report: E230001: Server SSL certificate verification failed: certificate issued
- server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none
- Shell curl command reported an error: (60) SSL certificate problem: self signed certificate
- [Solved] Error: unable to verify the first certificate
- Apache failed to start due to SSL library certificate has expired
- cURL error 60: SSL certificate problem: unable to get local issuer certificate
- GuzzleHttp cURL error 60: SSL certificate problem: self signed certificate
- Git prompt error setting certificate verify locations
- git clone Error: “server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLf…