Code: Select all
os.environ['REQUESTS_CA_BUNDLE'] = os.path.join('/path/to/','ca-own.crt')
s = requests.Session()
s.cert = ('some.crt', 'some.key')
s.get('https://some.site.com')
< /code>
Letzte Anweisung kehrt zurück: < /p>
requests.exceptions.SSLError: HTTPSConnectionPool(host='some.site.com', port=443): Max retries exceeded with url: / (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1131)')))
mit curl:
Code: Select all
curl --cacert ca-own.crt --key some.key --cert some.crt https://some.site.com
Gibt den normalen HTML -Code zurück.
P.S.
Code: Select all
s.verify = 'some.crt'
< /code>
oder < /p>
cat some.crt ca-own.crt > res.crt
Code: Select all
s.verify = 'res.crt'
Code: Select all
cat some.crt some.key > res.pem
Code: Select all
s.cert = "res.pem"
< /code>
requests.exceptions.SSLError: HTTPSConnectionPool(host='some.site.com', port=443): Max retries exceeded with url: / (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1131)')))
Code: Select all
cat ca-own.crt some.crt some.key > res.pem
Code: Select all
s.cert = "res.pem"
< /code>
requests.exceptions.SSLError: HTTPSConnectionPool(host='some.site.com', port=443): Max retries exceeded with url: / (Caused by SSLError(SSLError(116, '[X509: KEY_VALUES_MISMATCH] key values mismatch (_ssl.c:4067)')))