OS and Python distribution would be helpful but I guess you're on macOS?
If so, it looks as if you might have to install appropriate certificates. Check this search for example.
Short story ( I use Anaconda myself so I can't check) if you are using an installer from Python.org, there might be a "Install Certificates.command" file in "/Application/Python\ 3.7" (or thereabouts) which you can run to get them to install.
My laptop crashed after a routine download this week - long story short - I had to reinstall Python which gave me the chance to download the latest version: 3.7.2
So far so good but I've started getting errors when accessing endpoints on this site. The pertinent one (I think) is this:-
urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1056)>
I can run test codes to download API data from other sites but not chess.com. This is the cod I'm running:-
import urllib.request, json
url = 'https://api.chess.com/pub/match/885716'
def response(url):
____with urllib.request.urlopen(url) as response:
________return response.read()
res = response(url)
print(json.loads(res))
.
If for example I substitute 'https://hacker-news.firebaseio.com/v0/topstories.json?print=pretty' for the url, it works normally & other sites I've tried work fine too but not this one.
I've spent hours searching online for a solution but without success. If possible I'd like to continue using the Python urllib.request module.