Skip to main content

Practice · 1 of 2

Defensive Parsing

CHALLENGE
Difficulty: intermediate+25 XP

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.

Back to lesson: Practice: Client Behavior Drills