I am hosting a site using SSL / HTTPS, and am attempting to make a request to it from a Python 2.7 script on the server (Ubuntu 18.04).

When running the script, I get this error:

requests.exceptions.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:727)

However, when I run curl --verbose -X GET -I <url> on the same server, it says the certificate was verified.

I do know that the cert is in fact valid and is not a self signed cert.

Any ideas on what I can do to get python to accept that cert?

Edit: here's the code to trigger the issue. Note that I'm not including the URL as it is not accessible to the general public:

import requests
r = requests.get('https://www.example.org')
print r.status_code
0

There are 0 best solutions below