def stats_spider_closed(self, spider, spider_stats): mail = MailSender() body = "Global stats\n\n" body += "\n".join("%-50s : %s" % i for i in stats.get_stats().items()) body += "\n\n%s stats\n\n" % spider.name body += "\n".join("%-50s : %s" % i for i in spider_stats.items()) mail.send(self.recipients, "Scrapy stats for: %s" % spider.name, body)
def webconsole_render(self, wc_request): s = banner(self) s += "<h3>Global stats</h3>\n" s += stats_html_table(stats.get_stats()) for spider, spider_stats in stats.iter_spider_stats(): s += "<h3>%s</h3>\n" % spider.domain_name s += stats_html_table(spider_stats) s += "</body>\n" s += "</html>\n" return str(s)