Search RU
Tasks / API / Fix 429 handling
Statement medium

Fix 429 handling

`starter.py` has two bugs:

- `404` is retried, although it should raise `ApiError` immediately;
- on `429` it calls `sleep(0)` instead of the value from `Retry-After`.

Fix both branches. `sleep` is a function parameter, so nothing actually has to
wait.

apidebuggingrate-limit
solution.py Python 3.14
AI mentor

The AI mentor is available after you log in: it sees your attempt history and does not spend resources on anonymous requests.

Log in and ask
Hints 1 of 3 unlocked · attempts: 0
Hint 1

Compare the two statuses: `404` is an answer, `429` is a request to wait. What
should happen in each case?

Hint 2 — unlocks after 1 attempt
Hint 3 — unlocks after 3 attempts