【发布时间】:2015-05-06 20:00:46
【问题描述】:
我正在使用guv 和feedparser 同时解析多个提要。以下是我的代码:
guv.monkey_patch(time=True, socket=True)
def parse_feed(_feed):
return feedparser.parse(_feed)
def main():
urls = ["http://feeds.bbci.co.uk/news/rss.xml"]
pool = guv.GreenPool()
results = pool.starmap(parse_feed, zip(urls))
for resp in results:
print(str(resp))
但是,我得到以下输出:
{'bozo_exception': TypeError('a float is required',), 'bozo': 1, 'feed': {}, 'entries': []}
我在使用 Eventlet 时遇到了类似的问题,但在原生 Python 3 threading 库中没有。
【问题讨论】:
-
bozo_exception错误由feedparser.parse()返回。如果您在调用feedparser.parse之前修改parse_feed以打印_feed的值,它是否收到了您认为收到的内容? -
@larsks 谢谢。是的,它会打印列表中的 url。
标签: python lxml feedparser libuv