Loading lesson…
Level 1 · Apprentice0 XP
Validate data at the border and call many services at once.
Step 1 / 5
ProblemYour script reads JSON from an API as a plain dict. Somewhere deep inside, data['price'] is a string instead of a number and the script crashes an hour into a batch job.
← → step
Before this: Errors, retries and logging
🛠️ Your turn
Reading is not the skill, doing is. Try for ten minutes before you open the hint. Getting stuck first is what makes the solution stick.
1.Fetch 20 items from a public JSON API (for example jsonplaceholder) with httpx.AsyncClient and asyncio.gather, validate each into a Pydantic model, and print the time compared with a sequential loop.