Overview
Your complete guide to APIs and async
Three lessons about programs that talk to others: a REST API with its requests and codes, then asyncio, which gets many things done on one thread, then async generators, which hand data over piece by piece.
Each part opens with an animation, then what you need before you start, then the idea with code you run, then a step-by-step and a worked example. Read the parts in order, as each builds on the last.
Each part ends with myth vs reality, a multiple-choice question, cards that flip when tapped, and "check your understanding" questions with hidden answers. Use them before you say "got it".
Do not leave a part before its exercise tests pass. Reading alone proves nothing; the exercise does.
Pick a topic
A look at APIs and async
You first build an API a client asks and a server answers, then learn how your program waits for many replies at once without freezing, then how to receive data that arrives in batches.
| Part | Topic | You learn |
|---|---|---|
| 1 | RESTful APIs | Resources and verbs, status codes, Flask |
| 2 | Asynchronous Python | async and await, tasks and gather, cancellation |
| 3 | Async Generators & Comprehensions | async for, async generators and comprehensions |
| 4 | Server-side rendering with Jinja templates | Templates, inheritance, auto-escaping and Flask |
| 5 | WebSockets: a live two-way connection | The handshake, two-way messages, broadcasting and disconnects |
Done with this lesson?
Sign in to save your progress.