2
To change the values of the statistics generated during the Spider execution, you must use the "Stats Collection" interface. Handbook: http://doc.scrapy.org/en/latest/topics/stats.html
Examples:
Change a value:
stats.set_value('hostname', socket.gethostname())
Increase:
stats.inc_value('pages_crawled')
The 'Stats' object is a field of the 'Crawler' object'.
crawler.stats.get_value('start_time')
Hello, Caio! Did you have any problem in putting into practice Renan’s answer? The Stats are like a global object for each job, so just get a reference to them and can change from any type of component (Spider, pipeline, middleware, etc).
– elias