From 1130711cc116b8902c8f743157299ee92b16ee96 Mon Sep 17 00:00:00 2001 From: Mikhail Korobov Date: Mon, 8 Jul 2019 11:17:30 +0500 Subject: [PATCH 1/3] deprecate scrapy.utils.http ChunkedTransferMiddleware is deprecated, so decode_chunked_transfer can be deprecated as well. --- scrapy/utils/http.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/scrapy/utils/http.py b/scrapy/utils/http.py index 7cc8d1884..b6e05c862 100644 --- a/scrapy/utils/http.py +++ b/scrapy/utils/http.py @@ -4,8 +4,19 @@ Transitional module for moving to the w3lib library. For new code, always import from w3lib.http instead of this module """ +import warnings + +from scrapy.exceptions import ScrapyDeprecationWarning +from scrapy.utils.decorators import deprecated from w3lib.http import * + +warnings.warn("Module `scrapy.utils.http` is deprecated, " + "Please import from `w3lib.http` instead.", + ScrapyDeprecationWarning, stacklevel=2) + + +@deprecated def decode_chunked_transfer(chunked_body): """Parsed body received with chunked transfer encoding, and return the decoded body. From 64ff3cd6aac9009ab0fe4777224b8457b6abe790 Mon Sep 17 00:00:00 2001 From: Mikhail Korobov Date: Mon, 8 Jul 2019 11:18:15 +0500 Subject: [PATCH 2/3] deprecate scrapy.utils.multipart It was a shim for w3lib.form, but w3lib.form is deprecated as well. --- scrapy/utils/multipart.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/scrapy/utils/multipart.py b/scrapy/utils/multipart.py index ec26c0866..c2d8afd07 100644 --- a/scrapy/utils/multipart.py +++ b/scrapy/utils/multipart.py @@ -3,5 +3,13 @@ Transitional module for moving to the w3lib library. For new code, always import from w3lib.form instead of this module """ +import warnings +from scrapy.exceptions import ScrapyDeprecationWarning from w3lib.form import * + + +warnings.warn("Module `scrapy.utils.multipart` is deprecated. " + "If you're using `encode_multipart` function, please use " + "`urllib3.filepost.encode_multipart_formdata` instead", + ScrapyDeprecationWarning, stacklevel=2) \ No newline at end of file From cb4477db3e2ac4ee1972ac3832d036a08596fa7a Mon Sep 17 00:00:00 2001 From: Mikhail Korobov Date: Mon, 8 Jul 2019 11:18:40 +0500 Subject: [PATCH 3/3] deprecate scrapy.utils.markup it was an import-only shim for w3lib.html --- scrapy/utils/markup.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scrapy/utils/markup.py b/scrapy/utils/markup.py index 977133f4e..a18f308a3 100644 --- a/scrapy/utils/markup.py +++ b/scrapy/utils/markup.py @@ -3,5 +3,12 @@ Transitional module for moving to the w3lib library. For new code, always import from w3lib.html instead of this module """ +import warnings +from scrapy.exceptions import ScrapyDeprecationWarning from w3lib.html import * + + +warnings.warn("Module `scrapy.utils.markup` is deprecated. " + "Please import from `w3lib.html` instead.", + ScrapyDeprecationWarning, stacklevel=2) \ No newline at end of file