Is there a way to trigger a method in a Spider class just before it terminates?
I can terminate the spider myself, like this:
class MySpider(CrawlS
For the latest version(v1.7), just define closed(reason) method in your spider class.
closed(reason)
closed(reason): Called when the spider closes. This method provides a shortcut to signals.connect() for the spider_closed signal.
closed(reason):
Called when the spider closes. This method provides a shortcut to signals.connect() for the spider_closed signal.
Scrapy Doc : scrapy.spiders.Spider.closed