We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d52c188 commit c4da0b5Copy full SHA for c4da0b5
docs/topics/stats.rst
@@ -29,12 +29,17 @@ opened when the spider is opened, and closed when the spider is closed.
29
Common Stats Collector uses
30
===========================
31
32
-Access the stats collector throught the :attr:`~scrapy.crawler.Crawler.stats`
33
-attribute::
+Access the stats collector through the :attr:`~scrapy.crawler.Crawler.stats`
+attribute. Here is an example of an extension that access stats::
34
35
- @classmethod
36
- def from_crawler(cls, crawler):
37
- stats = crawler.stats
+ class ExtensionThatAccessStats(object):
+
+ def __init__(self, stats):
38
+ self.stats = stats
39
40
+ @classmethod
41
+ def from_crawler(cls, crawler):
42
+ return cls(crawler.stats)
43
44
Set stat value::
45
0 commit comments