From c79bd6d0ba2a7bd8bd51ba65d06149b4ee7923f6 Mon Sep 17 00:00:00 2001 From: jesopo Date: Thu, 28 Nov 2019 07:35:16 +0000 Subject: [PATCH] utils.http.Response.decode() should default to detected encoding --- src/utils/http.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils/http.py b/src/utils/http.py index 699c48f1..83d6523b 100644 --- a/src/utils/http.py +++ b/src/utils/http.py @@ -122,8 +122,8 @@ class Response(object): self.encoding = encoding self.headers = headers self.cookies = cookies - def decode(self, encoding="utf8") -> str: - return self.data.decode(encoding) + def decode(self, encoding: typing.Optional[str]=None) -> str: + return self.data.decode(encoding or self.encoding) def json(self) -> typing.Any: return _json.loads(self.data) def soup(self, parser: str="lxml") -> bs4.BeautifulSoup: