Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

certificate verify failed: unable to get local issuer certificate

I am trying to get data from the web using python. I imported urllib.request package for it but while executing, I get error:

certificate verify failed: unable to get local issuer certificate (_ssl.c:1045) 
  • I am using Python 3.7 on Mac OS High Sierra.
  • I am trying to get CSV file from: https://s3.amazonaws.com/assets.datacamp.com/production/course_1606/datasets/winequality-red.csv

When I changed the URL to 'http' - I am able to get data. But, I believe, this avoids checking SSL certificate.

So I checked on the internet and found one solution: Run /Applications/Python\ 3.7/Install\ Certificates.command

This solved my problem. But I have no knowledge on SSL and the likes. Can you help me understand what it actually did to solve my issue.

If possible, please recommend me any good resource to learn about the security and certificates. I am new to this.

Thanks!

Note: I did go through the link - openssl, python requests error: "certificate verify failed"

My question differs from the one in link because, I want to know what actually happens when I install certifi package or run Install\ Certificates.command to fix the error. I have a poor understanding of securities.

like image 302
Biswajit Paul Avatar asked Oct 14 '18 17:10

Biswajit Paul


People also ask

How do I fix unable to get local issuer certificate?

When ssl certificate problem unable to get local issuer certificate error is caused by a self-signed certificate, the fix is to add the certificate to the trusted certificate store. Open the file ca-bundle. crt located in the directory above, then copy and paste the Git SSL certificate to the end of the file.

How do I install a certificate in Python?

To install certifi Python on Microsoft Windows: Type cmd in the search bar and hit Enter to open the command line. Type python3 -m pip install certifi in the command line and hit Enter again. This installs certifi for your default Python installation.

What is SSL certificate problem in git?

This error occur when self-signed certificate cannot be verified. By default the git verifies the self-signed certificate every time you push or pull the fixes to and from git server. By this command we tell the git not to perform validation of the certificate using global option.


1 Answers

For anyone who still wonders on how to fix this, i got mine by installing the "Install Certificates.command"

Here is how I did,

Install Certificates.commad location

Just double click on that file wait for it to install and in my case, you will be ready to go

like image 51
Ayyoub Avatar answered Oct 15 '22 17:10

Ayyoub