Skip to content

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

Deprecate the scrapy.utils.gz.is_gzipped function

Adrián Chaves7acf4eec792f
diff --git a/scrapy/utils/gz.py b/scrapy/utils/gz.py
index ec3949651..b3fb16b1e 100644
--- a/scrapy/utils/gz.py
+++ b/scrapy/utils/gz.py
@@ -9,6 +9,9 @@ from gzip import GzipFile
import six
import re
+from scrapy.utils.decorators import deprecated
+
+
# - Python>=3.5 GzipFile's read() has issues returning leftover
# uncompressed data when input is corrupted
# (regression or bug-fix compared to Python 3.4)
@@ -53,6 +56,7 @@ def gunzip(data):
_is_gzipped = re.compile(br'^application/(x-)?gzip\b', re.I).search
_is_octetstream = re.compile(br'^(application|binary)/octet-stream\b', re.I).search
+@deprecated
def is_gzipped(response):
"""Return True if the response is gzipped, or False otherwise"""
ctype = response.headers.get('Content-Type', b'')