redditwarp.http.util.json_loading#
- redditwarp.http.util.json_loading.load_json_from_response(resp: Response, /) Any[source]#
Return the JSON data contained in a response object.
- Parameters:
response (
Response) –
- Return type:
Any
- Raises:
ValueError – The response does not contain valid JSON data.
- redditwarp.http.util.json_loading.load_json_from_response_but_prefer_status_code_exception_on_failure(resp: Response, /) Any[source]#
Return the JSON data contained in a response object.
Behaves similarly to
load_json_from_response()but prefers to raise aStatusCodeExceptioninstead of aValueErrorwhen the response body does not contain JSON.