scrapy.downloadermiddlewares.httpcache.HttpCacheMiddleware

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 7

Example 1

Project: scrapy Source File: test_downloadermiddleware_httpcache.py
Function: middleware
    @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)