Practice ยท 1 of 2
Defensive Parsing
Implement parse_response(status, body) where body is bytes: 204 โ {}; non-JSON body โ raise ApiError('non-JSON response'); status >= 400 โ raise ApiError containing the status; else return parsed JSON.
Difficulty: intermediate
Press Submit to check your solution.
Back to lesson: Practice: Client Behavior Drills