Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why do HTTPS requests produce SSL CERTIFICATE_VERIFY_FAILED error?

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.

like image 698
rayashi Avatar asked Aug 09 '18 13:08

rayashi


People also ask

What causes SSL certificate errors?

An SSL certificate error occurs when a web browser can't verify the SSL certificate installed on a site. Rather than connect users to your website, the browser will display an error message, warning users that the site may be insecure.

How do you fix an SSL error has occurred?

If you run into an SSL connection error in Google Chrome, there are several quick fixes that you can implement. First off, make sure you're running the latest version of Chrome. You can update Chrome from within the browser itself, or you can download and install the most recent version from Google Chrome's website.

What is SSL certificate Python requests?

Requests verifies SSL certificates for HTTPS requests, just like a web browser. SSL Certificates are small data files that digitally bind a cryptographic key to an organization's details. Often, a website with a SSL certificate is termed as secure website.


1 Answers

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.

like image 134
Hagai Wild Avatar answered Oct 11 '22 20:10

Hagai Wild