From 72fbb687d7a35ddf52f82b165df0a842d0b653e0 Mon Sep 17 00:00:00 2001 From: Paul Tremberth Date: Fri, 3 Mar 2017 12:31:05 +0100 Subject: [PATCH] Revert "expose allowed_status tuple for media pipeline" This reverts commit 052809c73ed20b9a728a8fd7df3de5f45f2dad8d. --- scrapy/downloadermiddlewares/redirect.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/scrapy/downloadermiddlewares/redirect.py b/scrapy/downloadermiddlewares/redirect.py index ae4ad8891..26677e527 100644 --- a/scrapy/downloadermiddlewares/redirect.py +++ b/scrapy/downloadermiddlewares/redirect.py @@ -57,8 +57,6 @@ class RedirectMiddleware(BaseRedirectMiddleware): Handle redirection of requests based on response status and meta-refresh html tag. """ - allowed_status = (301, 302, 303, 307) - def process_response(self, request, response, spider): if (request.meta.get('dont_redirect', False) or response.status in getattr(spider, 'handle_httpstatus_list', []) or @@ -66,7 +64,8 @@ class RedirectMiddleware(BaseRedirectMiddleware): request.meta.get('handle_httpstatus_all', False)): return response - if 'Location' not in response.headers or response.status not in self.allowed_status: + allowed_status = (301, 302, 303, 307) + if 'Location' not in response.headers or response.status not in allowed_status: return response location = safe_url_string(response.headers['location'])