Here are the examples of the python api scrapy.downloadermiddlewares.httpcache.HttpCacheMiddleware taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
1 Examples
3
Example 1
@contextmanager
def _middleware(self, **new_settings):
settings = self._get_settings(**new_settings)
mw = HttpCacheMiddleware(settings, self.crawler.stats)
mw.spider_opened(self.spider)
try:
yield mw
finally:
mw.spider_closed(self.spider)