0

I have some code which is decoding a URL, but whenever I run it I get following error:

urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] 
certificate verify failed: unable to get local issuer certificate (_ssl.c:1076)>

What I've already done:

I've upgraded to Python 3.9, I'm using PyCharm to run my code on my Mac, I've run the Install Certifications command from Python successfully, and I've also upgraded to use the latest pip.

Dharman
  • 30,962
  • 25
  • 85
  • 135
CMJ
  • 103
  • 9

2 Answers2

0

You're probably trying to access a website which either uses a self-signed cert or an unsupported certificate verification algorithm. If you are using a self-signed cert, you need to make it known to python before opening the URL. If the server is using an unsupported certificate algorithm, please contact the maintainers to install their updates.

In the first case, this question+answers may help: How to get Python requests to trust a self signed SSL certificate?

See also this article: https://izziswift.com/how-to-get-python-requests-to-trust-a-self-signed-ssl-certificate/

  • I'm not sure exactly what I would have to do to make it known to python before opening the URL.. :-) – CMJ Dec 21 '20 at 11:30
  • I updated my answer. You should update your question to clarify whether you are using a self-signed certificate or not. – genodeftest Dec 21 '20 at 11:37
0

I found out what was wrong ... I use PyCharm, and it hadn't changed to use Python 3.9 but now it does :-)

CMJ
  • 103
  • 9