When making a request with urllib
:
from urllib.request import urlopen
f = urlopen('http://example.com/foo')
I observed: urlopen error [SSL: CERTIFICATE_VERIFY_FAILED]
.
This answer led me to PEP 476, and I was able to resolve the issue using:
f = urlopen('http://example.com/foo', context=ssl._create_unverified_context())
My question is:
Why does this this work, given that my request uses http://
and not https://
?