并发 Python 维基百科包请求 [英] Concurrent Python Wikipedia Package Requests
问题描述
我正在制作一个 python 应用程序,它使用 python 维基百科包来检索 3 个不同维基百科页面的正文.但是,我注意到在一次检索一篇文章时性能非常低.有没有一种方法可以同时检索 3 个维基百科页面的正文?
I am making a python application which uses the python Wikipedia package to retrieve the body text of 3 different Wikipedia pages. However, I am noticing very slow performance when retrieving the articles one at a time. Is there a method that I can use to retrieve the body text of 3 Wikipedia pages in parallel?
推荐答案
如果您想要原始"页面,您可以使用任何 python 抓取库,例如 扭曲/scrapy.但是,如果您正在寻找解析的 wiki 格式,您应该使用 pywikibot/mwparserfromhell 多进程.
If you want the 'raw' page you can use any python scraping library such as twisted/scrapy. But, if you are looking for the parsed wiki format you should use pywikibot/mwparserfromhell with multiprocess.
这篇关于并发 Python 维基百科包请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!