我有像这样的scrapy蜘蛛中间件类
class SaveSpiderMidlleWare:
""" This is a middleware class which handles all the operations of saving the spider response data into flat file """
def process_spider_output(response, result, spider):
print("Response :",response.url)
return response
哪个会返回此错误
TypeError: process_spider_output() got multiple values for keyword argument 'response'
触发抓取蜘蛛
答案 0 :(得分:4)
def process_spider_output(response, result, spider):
应该是
def process_spider_output(self, response, result, spider):
这个方法是中间件对象的方法,python中的对象方法总是将对象引用作为第一个参数。 Docs for this method可能不包括self
param,可能假设它的存在是显而易见的。