I’m trying a simple Python get request but failing. As described here, I should be able to:
JavaScript
x
5
1
import requests
2
3
response = requests.get('https://httpbin.org/get')
4
print(response.headers)
5
But instead I get
JavaScript
1
2
1
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1108)
2
I’m running a script from a Windows command prompt. Is it perhaps because I’m behind a company firewall?
Advertisement
Answer
The quickest fix is setting verify=False
:
JavaScript
1
2
1
response = requests.get('https://httpbin.org/get', verify=False)
2
Posibly duplicate https://stackoverflow.com/a/12864892/8473136