楼主: 万人往LVR
3214 0

urllib2.urlopen出错 [推广有奖]

  • 1关注
  • 13粉丝

已卖:2份资源

副教授

82%

还不是VIP/贵宾

-

威望
0
论坛币
5127 个
通用积分
816.2492
学术水平
70 点
热心指数
112 点
信用等级
40 点
经验
9088 点
帖子
625
精华
0
在线时间
1182 小时
注册时间
2013-7-18
最后登录
2024-6-25

楼主
万人往LVR 在职认证  发表于 2015-8-7 14:14:08 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
  1. import urllib2
  2. url = 'https://detail.tmall.com/item.htm?id=44421684993'
  3. content = urllib2.urlopen(url).read();
复制代码



结果是
  1. Traceback (most recent call last):
  2.   File "D:/backup/asos/爬虫/代理ip", line 9, in <module>
  3.     content = urllib2.urlopen(url).read();
  4.   File "C:\Python27\lib\urllib2.py", line 126, in urlopen
  5.     return _opener.open(url, data, timeout)
  6.   File "C:\Python27\lib\urllib2.py", line 406, in open
  7.     response = meth(req, response)
  8.   File "C:\Python27\lib\urllib2.py", line 519, in http_response
  9.     'http', request, response, code, msg, hdrs)
  10.   File "C:\Python27\lib\urllib2.py", line 438, in error
  11.     result = self._call_chain(*args)
  12.   File "C:\Python27\lib\urllib2.py", line 378, in _call_chain
  13.     result = func(*args)
  14.   File "C:\Python27\lib\urllib2.py", line 625, in http_error_302
  15.     return self.parent.open(new, timeout=req.timeout)
  16.   File "C:\Python27\lib\urllib2.py", line 406, in open
  17.     response = meth(req, response)
  18.   File "C:\Python27\lib\urllib2.py", line 519, in http_response
  19.     'http', request, response, code, msg, hdrs)
  20.   File "C:\Python27\lib\urllib2.py", line 438, in error
  21.     result = self._call_chain(*args)
  22.   File "C:\Python27\lib\urllib2.py", line 378, in _call_chain
  23.     result = func(*args)
  24.   File "C:\Python27\lib\urllib2.py", line 625, in http_error_302
  25.     return self.parent.open(new, timeout=req.timeout)
  26.   File "C:\Python27\lib\urllib2.py", line 400, in open
  27.     response = self._open(req, data)
  28.   File "C:\Python27\lib\urllib2.py", line 418, in _open
  29.     '_open', req)
  30.   File "C:\Python27\lib\urllib2.py", line 378, in _call_chain
  31.     result = func(*args)
  32.   File "C:\Python27\lib\urllib2.py", line 1215, in https_open
  33.     return self.do_open(httplib.HTTPSConnection, req)
  34.   File "C:\Python27\lib\urllib2.py", line 1177, in do_open
  35.     raise URLError(err)
  36. URLError: <urlopen error [Errno 1] _ssl.c:504: error:140943FC:SSL routines:SSL3_READ_BYTES:sslv3 alert bad record mac>
复制代码


然而url换成非淘宝网址就没问题;各种header也加过,没用。
请问这个错误是怎么回事?怎么解决?
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

关键词:urllib Open url lib Pen import

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2026-1-2 05:14