Modern APIs with FastAPI, Pydantic, and Python Course

Course Summary

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.

What students are saying

Want learn how modern Python can do for your next project? Go check out the new course by Michael Kennedy on FastAPI. The course is amazingly well done and FastAPI is a katana :D
-- FK

Source code and course GitHub repository

github.com/talkpython/modern-apis-with-fastapi

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.

Proceeds support the FastAPI project

Talk Python is a gold sponsor of the FastAPI project. By taking our course, you'll be helping support the improvement and sustainability of FastAPI itself.

What topics are covered

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

View the full course outline.

Who is this course for?

This course is for anyone who wants to build an API with Python as the backend language. If you want your API to rival the speed and features of any major web API framework, this is the course to take.

The student requirements are quite light for this course. You'll need Basic Python language knowledge:

  • Functions
  • Strings
  • Variables
  • API clients (making a call with requests)

Note: All software used during this course, including editors, Python language, etc., are 100% free and open source. You won't have to buy anything to take the course.

Concepts backed by concise visuals

While exploring a topic interactively with demos and live code is very engaging, it can mean losing the forest for the trees. That's why when we hit a new topic, we stop and discuss it with concise and clear visuals.

Here's an example of understanding how FastAPI leverages Python's type hints to indicate require and optional parameters in an API call as well as for type conversion.

Example: Concepts backed by concise visuals

Get hands-on for almost every chapter

While watching videos is great to give you that high level overview of what you need to know about a technology, nothing makes that skill your own like writing actual code and creating real web APIs.

In this course, you'll have access to all the source code at github.com/talkpython/modern-apis-with-fastapi. You're encouraged to follow along as we build the various APIs and explore the language features throughout this course.

This course is delivered in very high resolution

Example of 1440p high res video

This course is delivered in 1440p (4x the pixels as 720p). When you're watching the videos for this course, it will feel like you're sitting next to the instructor looking at their screen.

Every little detail, menu item, and icon is clear and crisp. Watch the introductory video at the top of this page to see an example.

Follow along with subtitles and transcripts

Each course comes with subtitles and full transcripts. The transcripts are available as a separate searchable page for each lecture. They also are available in course-wide search results to help you find just the right lecture.

Each course has subtitles available in the video player.

Who am I? Why should you take my course?

Who is Michael Kennedy?

My name is Michael, nice to meet you. ;) There are a couple of reasons I'm especially qualified to teach you Python.

 1. I'm the host of the #1 podcast on Python called Talk Python To Me. Over there, I've interviewed many of the leaders and creators in the Python community. I bring that perspective to all the courses I create.

 2. I've been a professional software trainer for over 10 years. I have taught literally thousands of professional developers in hundreds of courses throughout the world.

 3. Students have loved my courses. Here are just a few quotes from past students of mine.

"Michael is super knowledgeable, loves his craft, and he conveys it all well. I would highly recommend his training class anytime." - Robert F.
"Michael is simply an outstanding instructor." - Kevin R.
"Michael was an encyclopedia for the deep inner workings of Python. Very impressive." - Neal L.

Free office hours keep you from getting stuck

One of the challenges of self-paced online learning is getting stuck. It can be hard to get the help you need to get unstuck.

That's why at Talk Python Training, we offer live, online office hours. You drop in and join a group of fellow students to chat about your course progress and see solutions via screen sharing.

Just visit your account page to see the upcoming office hour schedule.

The time to act is now

If you are at all interested in building web APIs, you owe it to yourself to give FastAPI a look. This 4-hour course is just the right amount of hands on and no fluff for you to decide right away if FastAPI is right for your next project. Take the course and find out for yourself.

Not sure? You've got nothing to lose. Every one of our courses comes with a 2-week money-back guarantee including this one!

Course Outline: Chapters and Lectures

Welcome to the course
14:25
Welcome to Modern APIs with FastAPI
1:03
Why FastAPI?
3:25
Modern Python and APIs
2:05
Fastapi vs. x
3:13
The big ideas covered in the course
2:29
Student prerequisites
0:48
Your instructor: Michael Kennedy
0:39
Get the full story on FastAPI
0:43
Setup and following along
5:20
Python version
2:17
Recommended editor
1:41
PyCharm Pro for Free
0:30
Git the source code
0:52
Building our first API
30:58
Introducing our first API
0:50
Project setup
3:49
The most basic API
5:17
Concept: A minimal API endpoint
0:45
Know your HTTP verbs
3:09
Know your HTTP status codes
2:14
Passing data to the API
2:59
Concept: Passing data to the API
1:12
Responding to requests
5:33
Using specialized responses
1:28
Concept: Returning errors
1:22
A home page, of sorts
2:20
Modern language foundations
36:45
Modern language features
3:06
Type hints motivation
3:34
Adding type hints
2:41
Concept: Type hints
1:17
Non-async web scraper
2:30
Async web scraper
4:08
Concept: An async method
2:25
WSGI and ASGI servers
5:06
Model validation, the hard way
6:20
Model validation, the Pydantic way
4:58
Concept: Pydantic models
0:40
Building a realistic API
48:24
Introducing our main API
2:08
Creating the weather project
2:36
Rendering HTML templates
6:40
Concept: Rendering HTML templates
1:16
Static files
2:44
Partitioning with routers
7:52
Concept: Partitioning with routers
1:20
Weather API signature
3:29
Pydantic models
3:26
Open Weather data info
3:28
Setting the API key (keeping secrets safe)
4:38
Calling open weather map synchronously
4:04
Making an async API method
3:30
Concept: Async API methods
1:13
Error handling and performance
14:33
Faster with caching data
5:58
Concept: Caching data
1:13
Error responses
5:08
Concept: Converting errors to responses
2:14
Accepting inbound data
36:12
Inbound data introduction
1:13
Weather report data layer
7:44
Viewing all reports via the API
3:20
Adding a weather report via the API
3:41
Calling the POST method with RESTful tools
2:20
Playing nice with status codes
1:31
Concept: Submitted a weather report
1:34
Building a report client app
5:51
Showing recent events on the home page
4:23
Automatic documentation with FastAPI and Swagger/OpenAPI
4:35
Deploying FastAPI on Linux with gunicorn and nginx
35:50
Deployment introduction
0:46
Surveying some hosting options
5:49
Create a cloud server
3:51
Connecting to and patching our server
2:04
Server topology with Gunicorn
3:18
Adding ohmyzsh
1:10
Preparing to run FastAPI on Ubuntu
3:37
Getting the source code from GitHub
4:16
venv forever
1:12
Gunicorn as Systemd unit
4:13
Installing and running nginx
3:29
Adding SSL for HTTPS on our API
2:05
Course conclusion and review
10:40
You've made it
0:26
Review: A minimal API endpoint
0:55
Review: Type hints
1:21
Review: Pydantic objects
1:33
Review: async view methods
0:53
Review: Rendering templates
1:02
Review: Status codes and responses
1:18
Review: Modifying data through the API
1:29
Review: Deployment
1:18
Thanks and goodbye
0:25
Buy for $49 + tax Bundle and save 85% Team Gift

Questions? Send us an email: contact@talkpython.fm

Talk Python's Mastodon Michael Kennedy's Mastodon