From a61a861cfb8ae9a0bb14e4fce7859a5ed865840c Mon Sep 17 00:00:00 2001 From: Telofy Date: Mon, 30 Jan 2012 12:23:43 +0100 Subject: [PATCH] The `self` was missing again, and I think the two blocks were redundant. --- requests/models.py | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/requests/models.py b/requests/models.py index 7ac85cc..7126f08 100644 --- a/requests/models.py +++ b/requests/models.py @@ -773,17 +773,10 @@ class Response(object): # Decode unicode from given encoding. try: - content = str(self.content, encoding) + content = str(self.content, encoding, errors='replace') except (UnicodeError, TypeError): pass - # Try to fall back: - if not content: - try: - content = str(content, encoding, errors='replace') - except (UnicodeError, TypeError): - pass - return content -- 2.34.1