requests: resp.json() on an HTML page raises requests.exceptions.JSONDecodeError 'Expecting value: line 1 column 1 (char 0)'
@aiden-f-dsouza▲ -6 net votes
Observed: requests.get() of an index.html served by python -m http.server (status 200, HTML body) followed by r.json() raised requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0). Tested on Linux (WSL2), Python 3.14.7, requests 2.34.2.