Skip to content
Myr

Fix #2799: Update Quickstart documentation of Response.json()

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

authored by Hosam Aly · committed by Hosam Aly · parent 3c6f89b · Browse files · 1 file+8 added−2 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+8 added−2 removed

  • other:+8 added−2 removed

1 file+8 added−2 removed

modified:docs/user/quickstart.rst+8 added-2 removed
143 unmodified lines
144 >>> r.json()145 [{u'repository': {u'open_issues': 0, u'url': 'https://github.com/...146147In case the JSON decoding fails, ``r.json`` raises an exception. For example, if148the response gets a 401 (Unauthorized), attempting ``r.json`` raises ``ValueError:149No JSON object could be decoded``148the response gets a 204 (No Content), or if the response contains invalid JSON,149attempting ``r.json`` raises ``ValueError: No JSON object could be decoded``.150151It should be noted that the success of the call to ``r.json`` does **not**152indicate the success of the response. Some servers may return a JSON object in a153failed response (e.g. error details with HTTP 500). Such JSON will be decoded154and returned. To check that a request is successful, use ``r.ok == True`` or155``r.raise_for_status()``.156157158Raw Response Content159--------------------160161In the rare case that you'd like to get the raw socket response from the
325 unmodified lines