urllib2.urlopen()打开mp3链接时,报错

请教各位,准备在VOA的官网上正常mp3文件,在用urllib2.urlopen()下载mp3类型文件时,报了URLError。有可能是哪些原因造成的呢?多谢各位。
使用的代码如下:
urllib2.urlopen('http://realaudio.rferl.org/voa/LERE/2013/07/19/6d07939b-45fc-4984-92b5-7f9ccc978ac5.mp3')
已经进行的一些尝试:
链接是浏览器中是可以正常访问的。
在chrome中修改user-agent为'aaa',也可以正常下载,应该可以排除网站限制了非浏览器访问。
下载html类型的链接正常。
感谢@依云的提醒,以下是Traceback:
>>>urllib2.urlopen('http://realaudio.rferl.org/voa/LERE/2013/07/19/6d07939b-45fc-4984-92b5-7f9ccc978ac5.mp3')
Traceback(mostrecentcalllast):
File"",line1,in
urllib2.urlopen('http://realaudio.rferl.org/voa/LERE/2013/07/19/6d07939b-45fc-4984-92b5-7f9ccc978ac5.mp3')
File"C:\Python27\lib\urllib2.py",line127,inurlopen
return_opener.open(url,data,timeout)
File"C:\Python27\lib\urllib2.py",line404,inopen
response=self._open(req,data)
File"C:\Python27\lib\urllib2.py",line422,in_open
'_open',req)
File"C:\Python27\lib\urllib2.py",line382,in_call_chain
result=func(*args)
File"C:\Python27\lib\urllib2.py",line1214,inhttp_open
returnself.do_open(httplib.HTTPConnection,req)
File"C:\Python27\lib\urllib2.py",line1187,indo_open
r=h.getresponse(buffering=True)
File"C:\Python27\lib\httplib.py",line1045,ingetresponse
response.begin()
File"C:\Python27\lib\httplib.py",line409,inbegin
version,status,reason=self._read_status()
File"C:\Python27\lib\httplib.py",line365,in_read_status
line=self.fp.readline(_MAXLINE+1)
File"C:\Python27\lib\socket.py",line476,inreadline
data=self._sock.recv(self._rbufsize)
error:[Errno10054]
慕沐林林
浏览 404回答 2
2回答
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript