>>> import urllib
>>> urllib.urlopen("http://www.xxxx.com")
<addinfourl at 75842120L whose fp = <socket._fileobject object at 0x00000000048442A0>>
всё нормально, но если открывать https, а мне надо именно https, то получается ошибка:
>>> urllib.urlopen("https://www.xxxx.com")
Traceback (most recent call last):
File "<interactive input>", line 1, in <module>
File "D:\Python27\lib\urllib.py", line 84, in urlopen
return opener.open(url)
File "D:\Python27\lib\urllib.py", line 205, in open
return getattr(self, name)(url)
File "D:\Python27\lib\urllib.py", line 435, in open_https
h.endheaders(data)
File "D:\Python27\lib\httplib.py", line 951, in endheaders
self._send_output(message_body)
File "D:\Python27\lib\httplib.py", line 811, in _send_output
self.send(msg)
File "D:\Python27\lib\httplib.py", line 773, in send
self.connect()
File "D:\Python27\lib\httplib.py", line 1158, in connect
self.sock = ssl.wrap_socket(sock, self.key_file, self.cert_file)
File "D:\Python27\lib\ssl.py", line 372, in wrap_socket
ciphers=ciphers)
File "D:\Python27\lib\ssl.py", line 134, in __init__
self.do_handshake()
File "D:\Python27\lib\ssl.py", line 296, in do_handshake
self._sslobj.do_handshake()
IOError: [Errno socket error] [Errno 8] _ssl.c:503: EOF occurred in violation of protocol