Scrapy, a fast high-level web crawling & scraping framework for Python.
Make HttpCompressionMiddleware changes backward-comaptible
Adrián Chaves5f2827efe7b0
diff --git a/scrapy/downloadermiddlewares/httpcompression.py b/scrapy/downloadermiddlewares/httpcompression.pyindex f03294d65..1a3f6962a 100644--- a/scrapy/downloadermiddlewares/httpcompression.py+++ b/scrapy/downloadermiddlewares/httpcompression.py@@ -37,8 +37,10 @@ class HttpCompressionMiddleware:"""This middleware allows compressed (gzip, deflate) traffic to besent/received from web sites"""- def __init__(self, *, crawler=None):+ def __init__(self, stats=None, *, crawler=None):if not crawler:+ if stats:+ self.stats = statsreturnself.stats = crawler.statsself._max_size = crawler.settings.getint("DOWNLOAD_MAXSIZE")