Skip to content
Myr

Merge pull request #3671 from chris-martin/json-ValueError

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

Document that Response.json() may raise ValueError

authored by Kenneth Reitz · committed by GitHub · parents d24da4a, a49c387 · Browse files · 1 file+1 added−0 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−0 removed

  • other:+1 added−0 removed

1 file+1 added−0 removed

modified:requests/models.py+1 added
816 unmodified lines
817 def json(self, **kwargs):818 """Returns the json-encoded content of a response, if any.819820 :param \*\*kwargs: Optional arguments that ``json.loads`` takes.821 :raises ValueError: If the response body does not contain valid json.822 """823824 if not self.encoding and self.content and len(self.content) > 3:825 # No encoding set. JSON RFC 4627 section 3 states we should expect
72 unmodified lines