用python下载Rss提要

用python下载Rss提要,python,python-2.7,rss,urllib2,urllib,Python,Python 2.7,Rss,Urllib2,Urllib,我有一个场景,需要下载提供的rss提要url的xml 我使用以下代码进行相同的操作: urls = ['http://static.espncricinfo.com/rss/livescores.xml', 'http://ibnlive.in.com/ibnrss/top.xml'] for rssUrl in urls: if rssUrl is not None: dom = parse(urllib.urlopen(rssUrl)) tmp

我有一个场景,需要下载提供的rss提要url的xml

我使用以下代码进行相同的操作:

urls = ['http://static.espncricinfo.com/rss/livescores.xml', 'http://ibnlive.in.com/ibnrss/top.xml']   

for rssUrl in urls:
    if rssUrl is not None:
        dom = parse(urllib.urlopen(rssUrl))
        tmp = dom.toprettyxml()
当我作为一个独立的应用程序运行时,它运行良好,没有任何问题

但是,当我从websocket应用程序调用此代码时,代码的执行并不一致


有时工作正常,有时不正常。加上这种行为是随机的。请问有谁能说出背后的原因吗

显示的错误是:-

<urlopen error [Errno 66] unknown>

我尝试使用urllib2而不是urllib。但问题依然存在。

有时它工作正常,有时则不正常-这是什么意思?怎么了?你能提供一个URL来复制吗?两个URL都很好用。如果你不打算发布一个完整的可复制示例,恐怕你得不到帮助。你如何设置你的websocket应用程序哪个库我正在使用ws4py库设置我的websocket你使用tornado还是gevent?