Situation: The
target site (for example, the URL of the pre-code, for example https://my-pre-prod-site.com/login ) uses a self-signed certificate. The site is accessible via https from the browser without any problems (the warning about the self-signed certificate is suppressed by adding the certificate to the trust store in the browser)
Problem:
A simple python script that makes a call to the target site using requests with an error with any of the following errors in different situations:
request.exceptions.SSLError: [Errno 0] _ssl.c: 344: error: 00000000: lib (0): func (0): reason (0)
or
request.exceptions.SSLError: SSL certificate verification: CERTIFICATE_VERIFY_FAILED] (_ssl.c: 590) Simple script used (in python tooltip):
import requests
res = requests.get('https://my-pre-prod-site.com/login')
** Things you've already tried **
- I do NOT to skip the ssl check. Therefore, verify = false is not an option for me.
- I already used below with the same error
res = requests.get('https://my-pre-prod-site.com/login', verify = os.path.join(os.getcwd(),'test.pem') where test.pem is the pem file created by combining the results of the following commands in the following order:
openssl rsa -in ~ / Desktop / CertPath / private.key -check
and
openssl x509 -pubkey -noout -in ~ / Desktop / CertPath / certificate.pem
The script starts with ~ / Desktop / CertPath, so getcwd () provides the correct certificate path.
- I tried another test.pem file where the concatenation order was canceled. He still throws the same error.
- .pem, , .key, , (), , .
,
- ElCapitan Mac
- 2.9.0
Python - 2.7.10
OpenSSL Python - OpenSSL 0.9.8zg 14 2015 .
. openssl . openssl - Ubuntu
Python 2.6, Openssl 1.x