1
0
mirror of https://github.com/scrapy/scrapy.git synced 2025-02-24 18:24:00 +00:00

extended documentation on how to access crawler stats from extensions

This commit is contained in:
Pablo Hoffman 2012-10-25 11:28:23 -02:00
parent 17d958469f
commit 8f4c879b58

View File

@ -29,12 +29,17 @@ opened when the spider is opened, and closed when the spider is closed.
Common Stats Collector uses
===========================
Access the stats collector throught the :attr:`~scrapy.crawler.Crawler.stats`
attribute::
Access the stats collector through the :attr:`~scrapy.crawler.Crawler.stats`
attribute. Here is an example of an extension that access stats::
class ExtensionThatAccessStats(object):
def __init__(self, stats):
self.stats = stats
@classmethod
def from_crawler(cls, crawler):
stats = crawler.stats
return cls(crawler.stats)
Set stat value::