Search code examples
pythonhttpget

Python get request: ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED]


I'm trying a simple Python get request but failing. As described here, I should be able to:

import requests

response = requests.get('https://httpbin.org/get')
print(response.headers)

But instead I get

ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1108)

I'm running a script from a Windows command prompt. Is it perhaps because I'm behind a company firewall?


Solution

  • The quickest fix is setting verify=False:

    response = requests.get('https://httpbin.org/get', verify=False)
    

    Posibly duplicate https://stackoverflow.com/a/12864892/8473136