user4927715
user4927715

Reputation:

TypeError: process_spider_output() got multiple values for keyword argument 'response'

I have a scrapy spider middle ware class like this

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

Which is returning this error

TypeError: process_spider_output() got multiple values for keyword argument 'response'

On triggering crawl spider

Upvotes: 2

Views: 687

Answers (1)

Pawel Miech
Pawel Miech

Reputation: 7822

def  process_spider_output(response, result, spider):

should be

 def process_spider_output(self, response, result, spider):

this method is method of middleware object, and object methods in python always take reference to object as first parameter. Docs for this method don't include self param probably assuming that its existence is obvious.

Upvotes: 7

Related Questions