28
votes

Here is my Python code:

    import requests
    requests.get('https://google.com')

This is the error:

requests.exceptions.SSLError: HTTPSConnectionPool(host='google.com', port=443):
Max retries exceeded with url: / (Caused by SSLError(SSLError(1, 
'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:833)'),))

Using Insomnia gives me an error related with certificates:

Error shown in Insomnia

My OS is Windows 7 Professional.

5
Please add your code - Hagai Wild
requests.get('google.com') - rayashi
I don't think it's related with the code - rayashi

5 Answers

54
votes
requests.get('https://google.com', verify='/path/to/certfile')

or you can skip verifications by doing this:

requests.get('https://google.com', verify=False)

You should specify your CA.

2
votes

This fixed it: Python referencing old SSL version

The openssl versions used to differ for python and the one offered by homebrew

if brew install python --with-brewd-openssl doesn't work try
brew install openssl brew install python
after uninstalling python

0
votes

You might add header and verify argument to by-pass ssl certificate security.

r = requests.get(URL, headers = {'User-agent': 'your bot 0.1'}, verify=False)

You should specify path your certificate if you have.

0
votes

If you are running under business network, contact the network administrator to apply required configurations at the network level.

-1
votes

I resolved my problem by installing openssl you can go here and download the Light version or any version suited to your needs: https://slproweb.com/products/Win32OpenSSL.html