utils.http.Response.decode() should default to detected encoding
This commit is contained in:
parent
8008532b30
commit
c79bd6d0ba
1 changed files with 2 additions and 2 deletions
|
@ -122,8 +122,8 @@ class Response(object):
|
||||||
self.encoding = encoding
|
self.encoding = encoding
|
||||||
self.headers = headers
|
self.headers = headers
|
||||||
self.cookies = cookies
|
self.cookies = cookies
|
||||||
def decode(self, encoding="utf8") -> str:
|
def decode(self, encoding: typing.Optional[str]=None) -> str:
|
||||||
return self.data.decode(encoding)
|
return self.data.decode(encoding or self.encoding)
|
||||||
def json(self) -> typing.Any:
|
def json(self) -> typing.Any:
|
||||||
return _json.loads(self.data)
|
return _json.loads(self.data)
|
||||||
def soup(self, parser: str="lxml") -> bs4.BeautifulSoup:
|
def soup(self, parser: str="lxml") -> bs4.BeautifulSoup:
|
||||||
|
|
Loading…
Reference in a new issue