add middleware to template project

This commit is contained in:
muriloviana 2016-10-18 17:29:16 -02:00
parent 6cc83c041e
commit d5bd44a5b9
2 changed files with 24 additions and 0 deletions

View File

@ -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')

View File

@ -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