如何在scrapy中的每个请求之间提供延迟? [英] How to give delay between each requests in scrapy?

查看:64
本文介绍了如何在scrapy中的每个请求之间提供延迟?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不想同时爬行并被阻止.我想每秒发送一个请求.

I don't want to crawl simultaneously and get blocked. I would like to send one request per second.

推荐答案

有一个 设置:

DOWNLOAD_DELAY

默认:0

下载器应该等待的时间(以秒为单位)从同一网站下载连续的页面.这个可以用限制爬取速度,避免对服务器造成太大冲击.

The amount of time (in secs) that the downloader should wait before downloading consecutive pages from the same website. This can be used to throttle the crawling speed to avoid hitting servers too hard.

DOWNLOAD_DELAY = 0.25    # 250 ms of delay

阅读文档:https://doc.scrapy.org/en/latest/index.html

这篇关于如何在scrapy中的每个请求之间提供延迟?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆