Skip to content

Scrapy, a fast high-level web crawling & scraping framework for Python.

added deprecation warning to ErrorPages downloader middleware

Pablo Hoffman0f690b03dc21
diff --git a/scrapy/contrib/downloadermiddleware/errorpages.py b/scrapy/contrib/downloadermiddleware/errorpages.py
index a665cbf81..a55f452b0 100644
--- a/scrapy/contrib/downloadermiddleware/errorpages.py
+++ b/scrapy/contrib/downloadermiddleware/errorpages.py
@@ -1,3 +1,5 @@
+import warnings
+
from scrapy.core.exceptions import IgnoreRequest
from scrapy.utils.response import response_status_message
@@ -8,6 +10,10 @@ class ErrorPagesMiddleware(object):
TODO: move this mw to spidermiddleware and remove me
"""
+ def __init__(self):
+ warnings.warn("scrapy.contrib.downloadermiddleware.errorpages.ErrorPagesMiddleware downloader middleware is deprecated - use scrapy.contrib.spidermiddleware.httperror.HttpErrorMiddleware spider middleware instead",
+ DeprecationWarning, stacklevel=2)
+
def process_response(self, request, response, spider):
status = response.status
if 200 <= status < 300 or status in getattr(spider, 'handle_httpstatus_list', []):