scrapy - ScrapyDeprecationWaring: Command's default `crawler` is deprecated and will be removed. Use `create_crawler` method to instantiate crawlers -
scrapy version 0.19
i using code @ page ( run multiple scrapy spiders @ once using scrapyd ). when run scrapy allcrawl, got
scrapydeprecationwaring: command's default `crawler` deprecated , removed. use `create_crawler` method instantiate crawlers here code:
from scrapy.command import scrapycommand import urllib import urllib2 scrapy import log class allcrawlcommand(scrapycommand): requires_project = true default_settings = {'log_enabled': false} def short_desc(self): return "schedule run available spiders" def run(self, args, opts): url = 'http://localhost:6800/schedule.json' s in self.crawler.spiders.list(): #this line raise warning values = {'project' : 'your_project_name', 'spider' : s} data = urllib.urlencode(values) req = urllib2.request(url, data) response = urllib2.urlopen(req) log.msg(response) how fix deprecationwarning ?
thanks
use:
crawler = self.crawler_process.create_crawler()
Comments
Post a Comment