SSL: CERTIFICATE_VERIFY_FAILED with urllib
I had the same issue. My python version is 3.6.5 and I'm on Mac OSX. When I tried to connect to the HTTPS
sites I started getting the
<urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:833)>
exception. So, it was so obvious to me that the python on my machine has no certificates. I just ran the file from the path /Applications/Python 3.6
with a file name Install Certificates.command
. This solved my issue.
I reffered to this post.
There is command line program that you can run on MacOsX that will install the certificates:
sudo /Applications/Python\ 3.6/Install\ Certificates.command
The sudo
command will prompt for you password to elevate your privileges.
a dirty (not safe in terms of security) but fast hack like this do the job for me:
import ssl
ssl._create_default_https_context = ssl._create_unverified_context