From 06462a6e794b2d016368959e4efe72eb86b2baea Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Thu, 18 Mar 2021 10:06:14 +0100 Subject: [PATCH] quickstart.rst: r.json() can raise JSONDecodeError on Py3 % `python2 -c "import requests ; requests.get('https://github.com').json()"` % `python3 -c "import requests ; requests.get('https://github.com').json()"` --- docs/user/quickstart.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/user/quickstart.rst b/docs/user/quickstart.rst index 7b0450c4..d7ffa96f 100644 --- a/docs/user/quickstart.rst +++ b/docs/user/quickstart.rst @@ -150,7 +150,9 @@ There's also a builtin JSON decoder, in case you're dealing with JSON data:: In case the JSON decoding fails, ``r.json()`` raises an exception. For example, if the response gets a 204 (No Content), or if the response contains invalid JSON, -attempting ``r.json()`` raises ``ValueError: No JSON object could be decoded``. +attempting ``r.json()`` raises ``ValueError: No JSON object could be decoded`` on +Python 2 and raises ``simplejson.JSONDecodeError`` or ``json.JSONDecodeError`` on +Python 3. It should be noted that the success of the call to ``r.json()`` does **not** indicate the success of the response. Some servers may return a JSON object in a