Skip to content
Myr

Revert "Cache the value of the `Response.text` property"

Before adoption: this commit came in with the history the project adopted, so no landing records it.

This reverts commit d232948188f922c137dd709b53f77c49d1442c84.

authored by Kenneth Reitz · committed by Kenneth Reitz · parent 8a81a43 · Browse files · 1 file+1 added−7 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+1 added−7 removed

  • other:+1 added−7 removed

1 file+1 added−7 removed

modified:requests/models.py+1 added-7 removed
651 unmodified lines
652 """653654 def __init__(self):655656 # bytes of the page:656 self._content = False657 self._content_consumed = False659 # unicode of the page:660 self._text = None658659 #: Integer Code of responded HTTP Status.660 self.status_code = None661
130 unmodified lines
792 # Trust that chardet isn't available or something went terribly wrong.793 except Exception:794 pass795796797 @property798 def text(self):799 """Content of the response, in unicode.800801 if Response.encoding is None and chardet module is available, encoding802 will be guessed.803 """804807 if self._text is not None:808 return self._text809805 # Try charset from content-type806 content = None807 encoding = self.encoding808
12 unmodified lines
821 content = str(self.content, errors='replace')822 except (UnicodeError, TypeError):823 pass824830 self._text = content825 return content826827 def raise_for_status(self, allow_redirects=True):828 """Raises stored :class:`HTTPError` or :class:`URLError`, if one occurred."""
19 unmodified lines