def __init__(self):
+ # bytes of the page:
self._content = False
self._content_consumed = False
+ # unicode of the page:
+ self._text = None
#: Integer Code of responded HTTP Status.
self.status_code = None
except Exception:
return 'utf-8'
-
@property
def text(self):
"""Content of the response, in unicode.
will be guessed.
"""
+ if self._text is not None:
+ return self._text
+
# Try charset from content-type
content = None
encoding = self.encoding
except (UnicodeError, TypeError):
pass
+ self._text = content
return content
def raise_for_status(self, allow_redirects=True):