apparent_encoding
authorKenneth Reitz <me@kennethreitz.com>
Mon, 17 Dec 2012 11:35:10 +0000 (06:35 -0500)
committerKenneth Reitz <me@kennethreitz.com>
Mon, 17 Dec 2012 11:35:10 +0000 (06:35 -0500)
requests/models.py

index 308abb3..92f2baf 100644 (file)
@@ -418,6 +418,11 @@ class Response(object):
             return False
         return True
 
+    @property
+    def apparent_encoding(self):
+        """The apparent encoding, provided by the lovely Charade library."""
+        return chardet.detect(self.content)['encoding']
+
     def iter_content(self, chunk_size=1, decode_unicode=False):
         """Iterates over the response data.  This avoids reading the content
         at once into memory for large responses.  The chunk size is the number