Concept
A request can fail in several ways: no network, a timeout, a 4xx or 5xx status, or a body that is not the JSON you expected. Good client code checks each one and reports it clearly.
The tutor works through these with you, in conversation and code. A session ends when you have shown them, not when a video does.
A few lines that show Handling API errors doing its job.
import requests
def fetch_user(name):
try:
r = requests.get(f"https://api.github.com/users/{name}", timeout=5)
r.raise_for_status()
return r.json()
except requests.Timeout:
raise RuntimeError("GitHub took too long")
except requests.HTTPError as e:
raise RuntimeError(f"GitHub said {e.response.status_code}")Calling response.json() without checking the status. A 404 or 500 often comes with an HTML or empty body, and the real error is hidden behind a confusing JSONDecodeError.
Your roadmap puts these before Handling API errors, unless you already know them.
Once a session shows you understand Handling API errors, it comes back for review. Each review takes a minute and tells the memory model how well you still know it.