mirror of https://github.com/scrapy/scrapy.git
Do not silently fail on gzip unzipping
This commit is contained in:
parent
11cdf58abe
commit
b174744b80
|
|
@ -1,6 +1,6 @@
|
|||
import zlib
|
||||
|
||||
from scrapy.utils.gz import gunzip, is_gzipped
|
||||
from scrapy.utils.gz import gunzip
|
||||
from scrapy.http import Response, TextResponse
|
||||
from scrapy.responsetypes import responsetypes
|
||||
from scrapy.exceptions import NotConfigured
|
||||
|
|
|
|||
|
|
@ -61,10 +61,7 @@ class SitemapSpider(Spider):
|
|||
if isinstance(response, XmlResponse):
|
||||
return response.body
|
||||
elif gzip_magic_number(response):
|
||||
try:
|
||||
return gunzip(response.body)
|
||||
except:
|
||||
pass
|
||||
return gunzip(response.body)
|
||||
# actual gzipped sitemap files are decompressed above ;
|
||||
# if we are here (response body is not gzipped)
|
||||
# and have a response for .xml.gz,
|
||||
|
|
|
|||
Loading…
Reference in New Issue