Resilient Mini Client
Challenge on lesson: Checkpoint: Production-Style API Client
CHALLENGE
Difficulty: intermediate+25 XP
Implement MiniClient(base_url, transport=None) with get(path) -> dict. Behavior: compose url = base_url + path; call transport(url) (None โ RuntimeError 'no network in sandbox'); the response object has .status and .read() -> bytes. On 200 parse and return JSON. On 5xx/429, retry up to 3 total attempts, then raise ApiError('exhausted retries'). On other 4xx, raise ApiError immediately. Non-JSON body on 200 raises ApiError('bad body').
Press Submit to check your solution.
Back to lesson: Checkpoint: Production-Style API Client