Understanding requests versus grequests

后端 未结 2 1971
闹比i
闹比i 2021-02-08 07:14

I\'m working with a process which is basically as follows:

  1. Take some list of urls.
  2. Get a Response object from each.
  3. Create a BeautifulSoup object
2条回答
  •  南方客
    南方客 (楼主)
    2021-02-08 07:43

    You are just sending requests too fast. As grequests is an async lib, all of these requests are almost sent simultaneously. They are too many.

    You just need to limit the concurrent tasks by grequests.map(rs, size=your_choice), I have tested grequests.map(rs, size=10) and it works well.

提交回复
热议问题