I'm trying to download an image from a url using the urllib.request library
import urllib.request
urllib.request.urlretrieve("myurl.com", "local-filename.jpg")
It's throwing a
urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1125)>
error when trying to download the image.
I searched the error on SO and a bunch of the answers are all for MacOS
https://stackoverflow.com/a/53310545/11110509
https://stackoverflow.com/a/58525755/11110509
telling you to go to into the Python folder and download
"Install Certificates.command".
But on windows there isn't such a file.
Another solution is to use
import ssl
ssl._create_default_https_context = ssl._create_unverified_context
But some comments are saying that's a bad practice.
Another solution in the first answer is telling me to do the command
pip install --upgrade certifi
but that doesn't work and I'm still getting the same error.
What's the solution for Windows 10? Current python version: 3.8.9