explicating the cause of LookupError with a better comment
authorMax Countryman <max.countryman@gmail.com>
Mon, 12 Mar 2012 02:22:29 +0000 (22:22 -0400)
committerMax Countryman <max.countryman@gmail.com>
Mon, 12 Mar 2012 02:22:29 +0000 (22:22 -0400)
requests/models.py

index 4bccb1e317f89c9c5d0cf248005479721d99ea3d..fa06948a7bae116dfe592265a489fd5a2cfc9dad 100644 (file)
@@ -789,7 +789,10 @@ class Response(object):
         try:
             content = str(self.content, encoding, errors='replace')
         except LookupError:
-            # try blindly encoding
+            # A LookupError is raised if the encoding was not found which could
+            # indicate a misspelling or similar mistake.
+            #
+            # So we try blindly encoding.
             content = str(self.content, errors='replace')
         except (UnicodeError, TypeError):
             pass