From edb07a452ccc94a24440d83389afabe9ebd44250 Mon Sep 17 00:00:00 2001 From: Sudhanshu Shekhar Date: Wed, 14 Jan 2015 02:31:03 +0530 Subject: [PATCH] Reset items_scraped instead of item_count items_scraped is the counter that needs to be reset each time we have scraped a specific number of items in the code instead of item_count (which represents the specific number of items needed before a message is logged). Updating the source code to reflect this. Removed some irrelevant words from the log message. Signed-off-by: Sudhanshu Shekhar --- docs/topics/extensions.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/topics/extensions.rst b/docs/topics/extensions.rst index 2ea53f737..0f88b8810 100644 --- a/docs/topics/extensions.rst +++ b/docs/topics/extensions.rst @@ -145,9 +145,9 @@ Here is the code of such extension:: def item_scraped(self, item, spider): self.items_scraped += 1 - if self.items_scraped == self.item_count: - spider.log("scraped %d items, resetting counter" % self.items_scraped) - self.item_count = 0 + if self.items_scraped % self.item_count == 0: + spider.log("scraped %d items" % self.items_scraped) + .. _topics-extensions-ref: