urllib HTTPS request: <urlopen error unknown url type: https>

Most likely your Python installation or operating system is broken.

Python has only support for HTTPS if it was compiled with HTTPS support. However, this should be the default for all sane installations.

HTTPS support is only available if the socket module was compiled with SSL support.

https://docs.python.org/3/library/http.client.html

Please clarify how you installed Python. Official Python distributions are available at python.org


I had the same problem with Anaconda but after installing the OpenSSL package, it works well.

conda install -c anaconda openssl

I ran into the similar problem.
I used anaconda, and I simply moved these two file to anaconda3\DLLs and it worked.

  • libcrypto-1_1-x64.dll
  • libssl-1_1-x64.dll

I don't know why.
The reason I know this is that I tried to use ssl module to ignore certificate errors.

import ssl
ctx = ssl.create_default_context()
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE

After these lines, the https error went away and gave me another error:
DLL load failed while importing _ssl: The specified module could not be found.

So I went to this post and found these two important files.

ps: the ssl module is not necessary.


Had this issue, and it was solved by upgrading Python with

brew upgrade python