我可以通过一个简单的命令在Scrapy中运行一个爬虫
scrapy crawl custom_spider -a input_val=5 -a input_val2=6
其中,input_val
和input_val2
是我传递给爬虫的值
上述方法运行良好。
然而,在使用Scrapyd调度爬虫时,运行以下命令:
curl http://localhost:6800/schedule.json -d project=crawler -d input_val=5 -d input_val2=6 -d spider=custom_spider
抛出一个错误。
spider = cls(*args, **kwargs)
exceptions.TypeError: __init__() got an unexpected keyword argument '_job'
我该怎么让这个工作起来?
编辑 这段代码在我的初始化器中:
def __init__(self,input_val=None, input_val2=None, *args, **kwargs):
self.input_val = input_val
self.input_val2 = input_val2
super(CustomSpider, self).__init__(*args, **kwargs)