Skip to content
Permalink
Browse files
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 <sudshekhar02@gmail.com>
  • Loading branch information
SudShekhar authored and dangra committed Feb 25, 2015
1 parent 7ee6f7a commit edb07a452ccc94a24440d83389afabe9ebd44250
Showing with 3 additions and 3 deletions.
  1. +3 −3 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:

0 comments on commit edb07a4

Please sign in to comment.