From f80b8514b9860b63e421f04a3f84bc7d79e996c8 Mon Sep 17 00:00:00 2001 From: Umair Ashraf Date: Mon, 16 May 2016 13:44:42 -0400 Subject: [PATCH] fixed deprecation warnings --- scrapy/contrib/downloadermiddleware/httpauth.py | 7 +++++-- scrapy/downloadermiddlewares/httpauth.py | 5 ++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/scrapy/contrib/downloadermiddleware/httpauth.py b/scrapy/contrib/downloadermiddleware/httpauth.py index 493a4cf6f..19fc303b5 100644 --- a/scrapy/contrib/downloadermiddleware/httpauth.py +++ b/scrapy/contrib/downloadermiddleware/httpauth.py @@ -1,7 +1,10 @@ import warnings from scrapy.exceptions import ScrapyDeprecationWarning warnings.warn("Module `scrapy.contrib.downloadermiddleware.httpauth` is deprecated, " - "use `scrapy.downloadermiddlewares.httpauth` instead", + "use `scrapy.downloadermiddlewares.auth` instead", ScrapyDeprecationWarning, stacklevel=2) -from scrapy.downloadermiddlewares.auth import AuthMiddleware as HttpAuthMiddleware +from scrapy.utils.deprecate import create_deprecated_class +from scrapy.downloadermiddlewares.auth import AuthMiddleware + +HttpAuthMiddleware = create_deprecated_class('HttpAuthMiddleware', AuthMiddleware) diff --git a/scrapy/downloadermiddlewares/httpauth.py b/scrapy/downloadermiddlewares/httpauth.py index 78adc8706..12b4372e5 100644 --- a/scrapy/downloadermiddlewares/httpauth.py +++ b/scrapy/downloadermiddlewares/httpauth.py @@ -4,4 +4,7 @@ warnings.warn("Module `scrapy.downloadermiddleware.httpauth` is deprecated, " "use `scrapy.downloadermiddlewares.auth` instead", ScrapyDeprecationWarning) -from scrapy.downloadermiddlewares.auth import AuthMiddleware as HttpAuthMiddleware +from scrapy.utils.deprecate import create_deprecated_class +from scrapy.downloadermiddlewares.auth import AuthMiddleware + +HttpAuthMiddleware = create_deprecated_class('HttpAuthMiddleware', AuthMiddleware)