下面是我的代码我用于废弃一些网页 我在窗口中使用python 8IO错误:[Errno套接字错误] [错误1] _ssl.c:507:错误:140770FC:SSL例程:SSL23_GET_SERVER_HELLO:未知协议
import urllib
import re
htmlfile = urllib.urlopen("https://finance.yahoo.com/q?s=aapl&ql=1")
htmltext = htmlfile.read()
regex='<span id="yfs_l84_aapl">(.+?)</span>'
pattern = re.compile(regex)
price = re.findall(pattern,htmltext)
print price
错误我得到
Traceback (most recent call last): File "C:\Python27\web.py", line 4, in htmlfile = urllib.urlopen(" https://finance.yahoo.com/q?s=aapl&ql=1 ") File "C:\Python27\lib\urllib.py", line 87, in urlopen return opener.open(url) File "C:\Python27\lib\urllib.py", line 208, in open return getattr(self, name)(url) File "C:\Python27\lib\urllib.py", line 437, in open_https h.endheaders(data) File "C:\Python27\lib\httplib.py", line 969, in endheaders self._send_output(message_body) File "C:\Python27\lib\httplib.py", line 829, in _send_output self.send(msg) File "C:\Python27\lib\httplib.py", line 791, in send self.connect() File "C:\Python27\lib\httplib.py", line 1176, in connect self.sock = ssl.wrap_socket(sock, self.key_file, self.cert_file) File "C:\Python27\lib\ssl.py", line 387, in wrap_socket ciphers=ciphers) File "C:\Python27\lib\ssl.py", line 143, in init self.do_handshake() File "C:\Python27\lib\ssl.py", line 305, in do_handshake self._sslobj.do_handshake() IOError: [Errno socket error] [Errno 1] _ssl.c:507: error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol
如何调试这个错误
提供有关您的刮刀响应的反馈。 –