Skip to content

Scrapy, a fast high-level web crawling & scraping framework for Python.

Add omitted "self" arguments

mangogao4274f0d4d4b3
diff --git a/scrapy/templates/project/module/middlewares.py.tmpl b/scrapy/templates/project/module/middlewares.py.tmpl
index 42318fec2..292bf572e 100644
--- a/scrapy/templates/project/module/middlewares.py.tmpl
+++ b/scrapy/templates/project/module/middlewares.py.tmpl
@@ -20,14 +20,14 @@ class ${ProjectName}SpiderMiddleware(object):
crawler.signals.connect(s.spider_opened, signal=signals.spider_opened)
return s
- def process_spider_input(response, spider):
+ def process_spider_input(self, response, spider):
# Called for each response that goes through the spider
# middleware and into the spider.
# Should return None or raise an exception.
return None
- def process_spider_output(response, result, spider):
+ def process_spider_output(self, response, result, spider):
# Called with the results returned from the Spider, after
# it has processed the response.
@@ -35,7 +35,7 @@ class ${ProjectName}SpiderMiddleware(object):
for i in result:
yield i
- def process_spider_exception(response, exception, spider):
+ def process_spider_exception(self, response, exception, spider):
# Called when a spider or process_spider_input() method
# (from other spider middleware) raises an exception.
@@ -43,7 +43,7 @@ class ${ProjectName}SpiderMiddleware(object):
# or Item objects.
pass
- def process_start_requests(start_requests, spider):
+ def process_start_requests(self, start_requests, spider):
# Called with the start requests of the spider, and works
# similarly to the process_spider_output() method, except
# that it doesn’t have a response associated.