scrapy中主动触发关闭爬虫的方法

Posted du-jun

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了scrapy中主动触发关闭爬虫的方法相关的知识,希望对你有一定的参考价值。

在spider中 主动关闭爬虫:

self.crawler.engine.close_spider(self, “cookie失效关闭爬虫”)

在pipeline 和downloadermiddlewares 主动关闭爬虫:

spider.crawler.engine.close_spider(spider, “全文结束关闭爬虫”)

以上是关于scrapy中主动触发关闭爬虫的方法的主要内容,如果未能解决你的问题,请参考以下文章