promptdojo_

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.

full-screen editor opens — close anytime to keep reading.