Python urllib2.urlopen() is slow, need a better way to read several urls

前端 未结 9 2241
谎友^
谎友^ 2020-11-28 04:48

As the title suggests, I\'m working on a site written in python and it makes several calls to the urllib2 module to read websites. I then parse them with BeautifulSoup.

9条回答
  •  萌比男神i
    2020-11-28 05:15

    Scrapy might be useful for you. If you don't need all of its functionality, you might just use twisted's twisted.web.client.getPage instead. Asynchronous IO in one thread is going to be way more performant and easy to debug than anything that uses multiple threads and blocking IO.

提交回复
热议问题