简体   繁体   中英

Python Webscraping: grequests vs. mult-threaded requests?

I'm trying to make web-scraper I'm writing in Python faster.

Currently I fire up a set amount of scraper threads, create a queue with a list of URLs I want to scrape and let them dequeue entries so they can scrape.

grequests states it's asynchronous but I'm not sure what the quite means beyond firing multiple threads (like I'm doing) and using gevent to trigger an event when it's finished.

Does grequests do anything more beyond create a thread per job and will it technically run more quickly than the program I've outlined above?

Check this out:

https://adl1995.github.io/a-comparison-of-response-times-using-urllib-grequests-and-asyncio.html

TL;DR:

"Using aiohttp with asyncio seems to be the best option. Its response time is almost 50% less than grequests ."

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM