HTTP from both sides: calling APIs and validating what comes back, then building, documenting and hosting an API of your own.
Before this guide: Python from the Start; Files, Paths and Formats; and Object-Oriented Python.
The notebooks
Open in Colab runs a notebook in your browser, and Read shows it on GitHub without running it. Every notebook runs on its own, and the answers to its exercises are in a separate notebook, linked as Solutions.
| 1 | What an API IsRequests, responses, methods, parameters and status codes: the vocabulary of every API | Open in ColabReadSolutions |
| 2 | Exploring an APIPostman, curl and interactive docs, and reading an API's documentation before writing code | Open in ColabReadSolutions |
| 3 | Your First Requestrequests.get, and everything the response object carries | Open in ColabReadSolutions |
| 4 | Status Codes200, 404, 429, 500, and what your code should do about each | Open in ColabReadSolutions |
| 5 | Query ParametersThe params argument, encoding, and building a URL correctly | Open in ColabReadSolutions |
| 6 | JSON in a ResponseParsing, nested structures, and reaching the field you want | Open in ColabReadSolutions |
| 7 | Schemas and ValidationJSON Schema, Pydantic, and a clear error when a response changes shape | Open in ColabReadSolutions |
| 8 | Headers and Content TypesWhat you sent, what came back, and why it matters | Open in ColabReadSolutions |
| 9 | AuthenticationAPI keys, bearer tokens, and never committing either | Open in ColabReadSolutions |
| 10 | PaginationCursors, page numbers, and a loop that terminates | Open in ColabReadSolutions |
| 11 | Rate Limits429, backoff, and being a good citizen of someone else's server | Open in ColabReadSolutions |
| 12 | Errors and RetriesTimeouts, connection failures, and what is worth retrying | Open in ColabReadSolutions |
| 13 | Sending DataPOST, PUT, DELETE, and what idempotent means in practice | Open in ColabReadSolutions |
| 14 | A Real ClientOne API wrapped in a small, testable module you would reuse | Open in ColabReadSolutions |
| 15 | Your First API ServerFastAPI, a route, and the documentation it writes for you | Open in ColabReadSolutions |
| 16 | Validating RequestsPydantic models on the server, and a 422 with a reason for bad input | Open in ColabReadSolutions |
| 17 | A Complete APIThe practice API rebuilt in FastAPI, with every method and the status codes a server chooses | Open in ColabReadSolutions |
| 18 | Hosting an APIFrom Colab to a public URL: a start command, secrets, and a free host | Open in ColabReadSolutions |
Sources
The real-API examples use weather data from Open-Meteo.com, offered under a CC BY 4.0 license and drawn from the ERA5 reanalysis. Generated using Copernicus Climate Change Service information 2026. Everything else these notebooks request comes from a practice API written for this guide.