Skip to main content

Modern APIs with FastAPI and Python Course

3h 53m 18s
English
Paid

FastAPI is one of the most exciting new web frameworks available today. It's captivating because it leverages modern Python language features like type hints, async and await, dataclasses, and much more. If you're building an API in Python, there are many choices, but FastAPI stands out as the clear choice for the future. This course will teach you everything you need to know to get started. We’ll build a realistic API with live data and deploy it to a cloud server Linux VM. Moreover, you will learn how to create proper HTML web pages to complement your API using FastAPI.

What Makes This Course Unique?

This course is designed to help you quickly create new APIs running in the cloud with FastAPI. We start with foundational concepts and quickly move to build our first API using FastAPI.

We'll explore core modern Python features, ensuring you are fully equipped to leverage this framework. You'll learn how async and await operates in Python, build self-validating classes with Pydantic, understand Python 3’s type hints, and other essential language concepts.

We conclude the course by building a realistic API working with live data and deploying it using nginx, gunicorn, and uvicorn on an Ubuntu cloud VM hosted at Digital Ocean.

Course Highlights

  • Discover the simplicity of working with basic APIs in FastAPI.
  • Create API methods handling common HTTP verbs (GET, POST, DELETE, etc.).
  • Return JSON data to API clients seamlessly.
  • Utilize async and await to develop truly scalable applications.
  • Leverage Pydantic to define required and optional data exchanges.
  • Enable FastAPI to automatically validate and convert data types (e.g., converting "2021-01-05" to a datetime).
  • Organize your app efficiently using APIRoutes to structure your application across Python files.
  • Return the most appropriate error responses (e.g., 400 Bad Request) to API clients.
  • Deploy Python web applications in production-ready configurations on Linux environments.
  • Understand the importance of using gunicorn and uvicorn together in production settings.
  • And much more!

About the Author: Talkpython

Talkpython thumbnail
Talk Python to Me is a weekly podcast hosted by Michael Kennedy. The show covers a wide array of Python topics as well as many related topics (e.g. MongoDB, AngularJS, DevOps).

Watch Online 84 lessons

This is a demo lesson (10:00 remaining)

You can watch up to 10 minutes for free. Subscribe to unlock all 84 lessons in this course and access 10,000+ hours of premium content across all courses.

View Pricing
0:00
/
#1: Welcome to Modern APIs with FastAPI
All Course Lessons (84)
#Lesson TitleDurationAccess
1
Welcome to Modern APIs with FastAPI Demo
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
Unlock unlimited learning

Get instant access to all 83 lessons in this course, plus thousands of other premium courses. One subscription, unlimited knowledge.

Learn more about subscription