Skip to content

Commit

Permalink
pylint related change
Browse files Browse the repository at this point in the history
  • Loading branch information
heorhiikorzh committed Nov 13, 2023
1 parent 123c8ab commit 62f4c2d
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions scrapy/downloadermiddlewares/httpcompression.py
Expand Up @@ -91,19 +91,18 @@ def process_response(

return response

def _raise_unsupported_compressors(self, request):
if isinstance(request, Request):
encodings = request.headers.getlist("Accept-Encoding")
unsupported = [key for key in encodings if key not in ACCEPTED_ENCODINGS]
if len(unsupported):
unsupported = [
unsupp for unsupp in unsupported if isinstance(unsupp, bytes)
]
unsupported_msg = b", ".join(unsupported) if len(unsupported) else "-"
raise NotSupported(
"Request is configured with Accept-Encoding header "
"with unsupported encoding(s): %s" % unsupported_msg
)
def _raise_unsupported_compressors(self, request: Request):
encodings = request.headers.getlist("Accept-Encoding")
unsupported = [key for key in encodings if key not in ACCEPTED_ENCODINGS]
if len(unsupported):
unsupported = [
unsupp for unsupp in unsupported if isinstance(unsupp, bytes)
]
unsupported_msg = b", ".join(unsupported) if len(unsupported) else "-"
raise NotSupported(
f"Request is configured with Accept-Encoding header with unsupported encoding(s): "
f"{unsupported_msg}"
)

def _decode(self, body: bytes, encoding: bytes) -> bytes:
if encoding == b"gzip" or encoding == b"x-gzip":
Expand Down

0 comments on commit 62f4c2d

Please sign in to comment.