- import urllib2
- url = 'https://detail.tmall.com/item.htm?id=44421684993'
- content = urllib2.urlopen(url).read();
结果是
- Traceback (most recent call last):
- File "D:/backup/asos/爬虫/代理ip", line 9, in <module>
- content = urllib2.urlopen(url).read();
- File "C:\Python27\lib\urllib2.py", line 126, in urlopen
- return _opener.open(url, data, timeout)
- File "C:\Python27\lib\urllib2.py", line 406, in open
- response = meth(req, response)
- File "C:\Python27\lib\urllib2.py", line 519, in http_response
- 'http', request, response, code, msg, hdrs)
- File "C:\Python27\lib\urllib2.py", line 438, in error
- result = self._call_chain(*args)
- File "C:\Python27\lib\urllib2.py", line 378, in _call_chain
- result = func(*args)
- File "C:\Python27\lib\urllib2.py", line 625, in http_error_302
- return self.parent.open(new, timeout=req.timeout)
- File "C:\Python27\lib\urllib2.py", line 406, in open
- response = meth(req, response)
- File "C:\Python27\lib\urllib2.py", line 519, in http_response
- 'http', request, response, code, msg, hdrs)
- File "C:\Python27\lib\urllib2.py", line 438, in error
- result = self._call_chain(*args)
- File "C:\Python27\lib\urllib2.py", line 378, in _call_chain
- result = func(*args)
- File "C:\Python27\lib\urllib2.py", line 625, in http_error_302
- return self.parent.open(new, timeout=req.timeout)
- File "C:\Python27\lib\urllib2.py", line 400, in open
- response = self._open(req, data)
- File "C:\Python27\lib\urllib2.py", line 418, in _open
- '_open', req)
- File "C:\Python27\lib\urllib2.py", line 378, in _call_chain
- result = func(*args)
- File "C:\Python27\lib\urllib2.py", line 1215, in https_open
- return self.do_open(httplib.HTTPSConnection, req)
- File "C:\Python27\lib\urllib2.py", line 1177, in do_open
- raise URLError(err)
- URLError: <urlopen error [Errno 1] _ssl.c:504: error:140943FC:SSL routines:SSL3_READ_BYTES:sslv3 alert bad record mac>
然而url换成非淘宝网址就没问题;各种header也加过,没用。
请问这个错误是怎么回事?怎么解决?


雷达卡




京公网安备 11010802022788号







