my_setting = crawler.settings.get('MY_SETTING')
kwargs['foo'] = my_setting
obj = super(MySpider, self).from_crawler(crawler, *args, **kwargs)
return obj
def __init__(self, *args, **kwargs): super(MySpider, self).__init__(*args, **kwargs) if self.settings['FOO']:
# Enter panic mode
class MySpider(scrapy.Spider):name = "myspider"def __init__(self, settings, *args, **kwargs):super(MySpider, self).__init__(*args, **kwargs)if settings['FOO']:# Enter panic modepass@classmethoddef from_crawler(cls, crawler, *args, **kwargs):spider = cls(crawler.settings, *args, **kwargs)spider._set_crawler(crawler)return spiderSorry about the noise ;),-Jakob
--
You received this message because you are subscribed to a topic in the Google Groups "scrapy-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/scrapy-users/U2DNE1a2Yd0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to scrapy-users...@googlegroups.com.
To post to this group, send email to scrapy...@googlegroups.com.
Visit this group at https://groups.google.com/group/scrapy-users.
For more options, visit https://groups.google.com/d/optout.