Scrapy, a fast high-level web crawling & scraping framework for Python.
add middleware to template project
murilovianad5bd44a5b9fa
diff --git a/scrapy/commands/startproject.py b/scrapy/commands/startproject.pyindex e3989baaf..1001b8682 100644--- a/scrapy/commands/startproject.py+++ b/scrapy/commands/startproject.py@@ -17,6 +17,7 @@ TEMPLATES_TO_RENDER = (('${project_name}', 'settings.py.tmpl'),('${project_name}', 'items.py.tmpl'),('${project_name}', 'pipelines.py.tmpl'),+ ('${project_name}', 'middleware.py.tmpl'),)IGNORE = ignore_patterns('*.pyc', '.svn')diff --git a/scrapy/templates/project/module/middleware.py.tmpl b/scrapy/templates/project/module/middleware.py.tmplnew file mode 100644index 000000000..0ae9d7160--- /dev/null+++ b/scrapy/templates/project/module/middleware.py.tmpl@@ -0,0 +1,23 @@+# -*- coding: utf-8 -*-++# Define here the models for your spider middleware+#+# See documentation in:+# http://doc.scrapy.org/en/latest/topics/spider-middleware.html+++class ${ProjectName}SpiderMiddleware(object):+ # This method is called for each response that goes through the+ # spider middleware and into the spider, for processing.++ def process_spider_input(response, spider):+ # Called for each response that goes to spider+ pass++ def process_spider_output(response, result, spider):+ # Called for each response with the spider results+ pass++ def process_spider_exception(response, exception, spider):+ # Called whenever a spider raises an exception+ pass