Skip to content

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

Fix deprecation of scrapy.pipelines.images.NoimagesDrop

PluT009f659bd63c04
diff --git a/scrapy/pipelines/images.py b/scrapy/pipelines/images.py
index df4575a41..c7a04a0cf 100644
--- a/scrapy/pipelines/images.py
+++ b/scrapy/pipelines/images.py
@@ -5,25 +5,28 @@ See documentation in topics/media-pipeline.rst
"""
import functools
import hashlib
+import warnings
from contextlib import suppress
from io import BytesIO
from itemadapter import ItemAdapter
-from scrapy.exceptions import DropItem, NotConfigured
+from scrapy.exceptions import DropItem, NotConfigured, ScrapyDeprecationWarning
from scrapy.http import Request
from scrapy.pipelines.files import FileException, FilesPipeline
# TODO: from scrapy.pipelines.media import MediaPipeline
from scrapy.settings import Settings
-from scrapy.utils.decorators import deprecated
from scrapy.utils.misc import md5sum
from scrapy.utils.python import to_bytes
-@deprecated()
class NoimagesDrop(DropItem):
"""Product with no images exception"""
+ def __init__(self, *args, **kwargs):
+ warnings.warn("The NoimagesDrop class is deprecated", category=ScrapyDeprecationWarning, stacklevel=2)
+ super().__init__(*args, **kwargs)
+
class ImageException(FileException):
"""General image error exception"""