[Python的自由天空] 关于scrapy中signals的用法请教

发信人: wasabi (──╥╨<(@), 信区: Python
标 题: 关于scrapy中signals的用法请教
发信站: 水木社区 (Thu Sep 28 00:01:38 2017), 转信

看了 scrapy 的官方文档,关于 signals 的函数在 from_crawler()中有如下示例代码:
crawler.signals.connect(ext.spider_opened, signal=signals.spider_opened) #代码 1
crawler.signals.connect(ext.spider_closed, signal=signals.spider_closed) #代码 2

对应两个方法定义如下:
def spider_opened(self, spider):
spider.log("opened spider %s" % spider.name)
def spider_closed(self, spider):
spider.log("closed spider %s" % spider.name)



恳请大家指点,上面代码中和 signals 的这几个函数和方法到底是完成了什么工作呢? 谢谢!

--

※ 来源:·水木社区 http://ift.tt/qTnhP3: 120.36.165.*]


from 水木社区 电脑技术区十大热门话题 http://ift.tt/2xLxefd
via IFTTT

评论

此博客中的热门博文

丰田将在 2019 东京车展上展出一台超迷你的都市型电动车

[数字家庭] [原创]北京联通IPTV的完美方案

英特尔将推出更多支持 e-SIM 的 modem