learning-it by example

Back to the video

How REST APIs Work: Build One with the Standard Library

9 calls to a tiny notes API gave 6 status codes, from 200 to 405.

Video #277 ยท How it works, by example

Steps in the video

  1. 0:00 Nine calls, six status codes, no packages
  2. 0:29 The idea
  3. 1:07 Setup
  4. 1:32 Two kinds of address
  5. 1:49 Methods and status codes
  6. 2:28 Bodies, 400 and 201
  7. 3:09 The client
  8. 3:33 Run it
  9. 4:35 What this does not show
  10. 5:13 Mistakes to avoid
  11. 5:43 My take and next steps
  12. 6:14 Recap

Files

  • api.py (83 lines)
  • client.py (17 lines)
  • run.py (29 lines)

Download the code (zip)

Tested with

Python 3.12.15

What this does not show

The notes and the server are a made-up toy for teaching. HEAD and OPTIONS get 501, and there is no authentication.

Sources

Learning IT by Example.