From 71cae121395da47b56a0b1ee8b1a5287686a0726 Mon Sep 17 00:00:00 2001 From: Pham Sy Minh <59408894+shelld3v@users.noreply.github.com> Date: Fri, 2 Aug 2024 11:16:58 +0700 Subject: [PATCH] Fix #1380 --- lib/connection/response.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/connection/response.py b/lib/connection/response.py index 73f05d2b5..40823cb77 100755 --- a/lib/connection/response.py +++ b/lib/connection/response.py @@ -45,9 +45,14 @@ def __init__(self, response): break if not is_binary(self.body): - self.content = self.body.decode( - response.encoding or DEFAULT_ENCODING, errors="ignore" - ) + try: + self.content = self.body.decode( + response.encoding or DEFAULT_ENCODING, errors="ignore" + ) + except LookupError: + self.content = self.body.decode( + DEFAULT_ENCODING, errors="ignore" + ) @property def type(self):