GET, status, JSON — the call AI makes 100 times a day — step 6 of 9
Claude wrote a truthy check for HTTP success: if status:. Any non-zero
status code is truthy in Python, including 404, 500, and every error.
The branch prints ok for an auth failure.
Fix line 4 so the check is == 200 and the script prints not ok for
the 401 response below.
Expected output:
not ok
The break is on line 4 — but read the whole snippet first.
⌘↵ runs the editor.read, then continue.
Claude wrote a truthy check for HTTP success: if status:. Any non-zero
status code is truthy in Python, including 404, 500, and every error.
The branch prints ok for an auth failure.
Fix line 4 so the check is == 200 and the script prints not ok for
the 401 response below.
Expected output:
not ok
The break is on line 4 — but read the whole snippet first.
this step needs the editor
on desktop today; in the app (coming soon). save your spot and we'll bring you back here when you're ready.