0

I am running python3 on Mac Mojavee I have the following code

from urllib.request import Request, urlopen
from urllib.error import URLError, HTTPError
req = Request("https://cognito-idp.us-west-2.amazonaws.com/us-west-2_OnQppLqYQ/.well-known/jwks.json")
try:
    response = urlopen(req)
except HTTPError as e:
    print('Error code: ', e.code)
except URLError as e:
    print('Reason: ', e.reason)
else:
    print('good!')

when I run it with python3, I get the famous cert error:

Reason:  [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1129)

I have read so many posts on this here and I am still stuck.

Anyone can help guide me?

reza
  • 5,972
  • 15
  • 84
  • 126

1 Answers1

1

Try running from the shell:

/Applications/Python\ 3.8/Install\ Certificates.command

Replace 3.8 with whatever version you're using.

Frank Yellin
  • 9,127
  • 1
  • 12
  • 22