python - spider_closed function is not fired -
i want log data when spider finishes working.
i make function inside spider.
def spider_closed(self, spider): log.msg('the spider {0} finished working on'.format(self.name), level=log.info)
but function not getting fired.
i using scrapy 0.20 python 2.7
please note can log log , logging lot of data can see in log file. logging working me.
edit
i guess have dispatch signal signals.spider_closed
don't know how that.
you should attach method receiver
signalmanager
signal dispatcher:
from scrapy.xlib.pydispatch import dispatcher scrapy import signals class myspider(spider): def __init__(self, *args, **kwargs): dispatcher.connect(self.spider_closed, signal=signals.spider_closed) super(myspider, self).__init__(*args, **kwargs) def spider_closed(self, spider): log.msg('the spider {0} finished working on'.format(self.name), level=log.info)
also see relevant threads:
Comments
Post a Comment