I was facing this problem as well. So what happened and what was the solution in my case.
Since my SSD one day had a I/O error I needed to buy a new SSD and install Windows 10 Pro. After Windows I was installing Python 3.11.2 and try to run a simple urllib code.
import urllib.request
web=urllib.request.urlopen('https//exemple.com')
....
I got thist error:
AttributeError: partially initialized module 'ssl' has no attribute 'create_default_context' (most likely due to a circular import)
After some google research I did many solution to solve this problem and at the end problem was just simple Windows Update since I didn't perform update after fresh installation... Ok, after that I did Windows Update but now I was receiving error which is the subject of this question topic...
Error was:
raise URLError('unknown url type: %s' % type)
urllib.error.URLError: urlopen error unknown url type: https
So I have tried everything, from different python versions and different python libraries, since Windows was not a problem, program just worked on another computer with Win 10 Pro, I have suspected drivers, installed all drivers and updated but problem was the same...
So I had a same program on USB, I have insert the USB and try the same program on USB it just worked without a problem... and I have started to analyze the problem. I have made another directory save the python program there and it worked perfectly, but in the previous directory with all other files I was getting the same error, so I have suspected that some file within that directory is making problem.
I have found out that by trying different solutions I have made a file name ssl.py and because of that i was getting the error described above.
After renaming the file to ssl1.py, my urllib script just worked fine...