You could use a closure function to do that, like this:
def spider_closed_handler(id):
def wrapped_handler(spider, reason):
self.update_state(id, FINISHED)
if all(val.state==FINISHED for val in self.crawlers.values()):
reactor.stop()
return wrapped_handler
Then:
crawler.signals.connect(spider_closed_handler(id),
signal=signals.spider_closed)
On Wed, Mar 26, 2014 at 9:22 AM, James Ford <[email protected]> wrote:
> Hello,
>
> I'm wondering if it is possible to pass an additional argument to a
> receiver function? Like below:
>
>
> spider_closed_handler(self, spider, reason, id):
> self.update_state(id, FINISHED)
> if all(val.state==FINISHED for val in self.crawlers.values()):
> reactor.stop()
>
> crawler.signals.connect(self.spider_closed_handler(id), signal=signals.
> spider_closed)
>
> Thanks,
>
> --
> You received this message because you are subscribed to the Google Groups
> "scrapy-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/scrapy-users.
> For more options, visit https://groups.google.com/d/optout.
>
--
You received this message because you are subscribed to the Google Groups
"scrapy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/scrapy-users.
For more options, visit https://groups.google.com/d/optout.