Modern APIs with FastAPI and Python Course
FastAPI is one of the most exciting new web frameworks out today. It's exciting because it leverages more of the modern Python language features than any other framework: type hints, async and await, dataclasses, and much more. If you are building an API in Python, you have many choices. But, to us, FastAPI is the clear choice going forward. And this course will teach you everything you need to know to get started. We'll build a realistic API working with live data and deploy that API to a cloud server Linux VM. In fact, you'll even see how to create proper HTML web pages to augment your API all within FastAPI.
More
What's this course about and how is it different?
This course is designed to get you creating new APIs running in the cloud with FastAPIs quickly. We start off with just a little foundational concepts, then jump right into build our first API with FastAPI.
Then we explore the foundational modern Python features to make sure you're ready to take full advantage of this framework. We'll look at how async and await works in Python, how to build self-validating and describing classes with Pydantic, Python 3's type hints, and other core language concepts.
We round out the course by building a realistic API working with live data. Then we deploy that API using nginx + gunicorn + uvicorn running on Ubuntu in a cloud VM at Digital Ocean.
In this course, you will:
- See how simple working with basic APIs in FastAPI can be.
- Create API methods that handle common HTTP verbs (GET, POST, DELETE, etc)
- Return JSON data to API clients
- Use async and await to create truly scalable applications
- Leverage Pydantic to create required and optional data exchange
- Have FastAPI automatically validate and convert data types (e.g. "2021-01-05" to a datetime)
- Organize your app using APIRoutes to properly factor your application across Python files.
- Return the most appropriate error response (e.g. 400 Bad Request) to API clients
- To deploy Python web applications in production-ready configurations on Linux
- Understand why gunicorn and uvicorn should be used together in production
- And lots more
Watch Online Modern APIs with FastAPI and Python Course
# | Title | Duration |
---|---|---|
1 | Welcome to Modern APIs with FastAPI | 01:03 |
2 | Why FastAPI? | 03:25 |
3 | Modern Python and APIs | 02:05 |
4 | Fastapi vs. x | 03:14 |
5 | The big ideas covered in the course | 02:30 |
6 | Student prerequisites | 00:49 |
7 | Your instructor: Michael Kennedy | 00:39 |
8 | Get the full story on FastAPI | 00:43 |
9 | Python version | 02:18 |
10 | Recommended editor | 01:41 |
11 | Git the source code | 00:53 |
12 | Introducing our first API | 00:50 |
13 | Project setup | 03:49 |
14 | The most basic API | 05:17 |
15 | Concept: A minimal API endpoint | 00:46 |
16 | Know your HTTP verbs | 03:09 |
17 | Know your HTTP status codes | 02:15 |
18 | Passing data to the API | 03:00 |
19 | Concept: Passing data to the API | 01:12 |
20 | Responding to requests | 05:34 |
21 | Using specialized responses | 01:29 |
22 | Concept: Returning errors | 01:23 |
23 | A home page, of sorts | 02:21 |
24 | Modern language features | 03:06 |
25 | Type hints motivation | 03:35 |
26 | Adding type hints | 02:41 |
27 | Concept: Type hints | 01:17 |
28 | Non-async web scraper | 02:30 |
29 | Async web scraper | 04:08 |
30 | Concept: An async method | 02:26 |
31 | WSGI and ASGI servers | 05:06 |
32 | Model validation, the hard way | 06:20 |
33 | Model validation, the Pydantic way | 04:59 |
34 | Concept: Pydantic models | 00:41 |
35 | Introducing our main API | 02:08 |
36 | Creating the weather project | 02:36 |
37 | Rendering HTML templates | 06:40 |
38 | Concept: Rendering HTML templates | 01:17 |
39 | Static files | 02:44 |
40 | Partitioning with routers | 07:53 |
41 | Concept: Partitioning with routers | 01:21 |
42 | Weather API signature | 03:30 |
43 | Pydantic models | 03:27 |
44 | Open Weather data info | 03:29 |
45 | Setting the API key (keeping secrets safe) | 04:39 |
46 | Calling open weather map synchronously | 04:05 |
47 | Making an async API method | 03:31 |
48 | Concept: Async API methods | 01:13 |
49 | Faster with caching data | 05:59 |
50 | Concept: Caching data | 01:13 |
51 | Error responses | 05:09 |
52 | Concept: Converting errors to responses | 02:14 |
53 | Inbound data introduction | 01:13 |
54 | Weather report data layer | 07:44 |
55 | Viewing all reports via the API | 03:21 |
56 | Adding a weather report via the API | 03:41 |
57 | Calling the POST method with RESTful tools | 02:20 |
58 | Playing nice with status codes | 01:32 |
59 | Concept: Submitted a weather report | 01:35 |
60 | Building a report client app | 05:52 |
61 | Showing recent events on the home page | 04:23 |
62 | Automatic documentation with FastAPI and Swagger/OpenAPI | 04:36 |
63 | Deployment introduction | 00:47 |
64 | Surveying some hosting options | 05:50 |
65 | Create a cloud server | 03:51 |
66 | Connecting to and patching our server | 02:04 |
67 | Server topology with Gunicorn | 03:18 |
68 | Adding ohmyzsh | 01:11 |
69 | Preparing to run FastAPI on Ubuntu | 03:37 |
70 | Getting the source code from GitHub | 04:16 |
71 | venv forever | 01:13 |
72 | Gunicorn as Systemd unit | 04:13 |
73 | Installing and running nginx | 03:30 |
74 | Adding SSL for HTTPS on our API | 02:05 |
75 | You've made it | 00:27 |
76 | Review: A minimal API endpoint | 00:55 |
77 | Review: Type hints | 01:21 |
78 | Review: Pydantic objects | 01:33 |
79 | Review: async view methods | 00:54 |
80 | Review: Rendering templates | 01:02 |
81 | Review: Status codes and responses | 01:18 |
82 | Review: Modifying data through the API | 01:30 |
83 | Review: Deployment | 01:19 |
84 | Thanks and goodbye | 00:25 |