urllib.error.URLError: <urlopen error unknown url type: 'https>
You should use urllib.parse.urlencode()
, urllib.parse.urljoin()
, etc functions to construct urls instead of manually joining the strings. It would take care of :
-> %3A
conversion e.g.:
>>> import urllib.parse
>>> urllib.parse.quote(':')
'%3A'
I figured it out. My url had a :
in it, and urllib
cannot use that character. I replaced it with %3A
and now it's working. Web browsers usually convert :
to %3A
automatically, but urllib
requires it to be converted first.