Video description
In this course, you will master FastAPI, one of the most efficient frameworks for building APIs. Starting with an introduction to API fundamentals and the REST architecture, you'll quickly move to creating your first FastAPI application. The course then delves into organizing and structuring your project, ensuring your API is scalable and maintainable. You will learn to implement social media features, handle posts and comments, and manage various aspects of API routing.
As you progress, you'll learn pytest, a robust testing framework. You'll write tests for your FastAPI applications, ensuring your code is reliable and bug-free. The following sections focus on integrating async databases, configuring environments, and leveraging Pydantic for configuration management. You will also explore logging, user authentication with JWTs, managing many-to-many relationships, and confirming user emails through various tools and services.
The course concludes with advanced topics such as file uploads, background tasks for image generation, and deploying FastAPI applications. You'll learn to update your projects to the latest versions of Pydantic, deploy your app to platforms like Render, and manage errors with Sentry. The course also includes continuous integration with GitHub Actions, streamlining and automating your development process.
What you will learn
- Build and deploy scalable FastAPI applications
- Implement robust testing strategies with pytest
- Integrate async databases and manage configurations
- Enhance applications with advanced logging and authentication
- Execute background tasks and manage file uploads
- Deploy applications to cloud platforms and implement CI/CD
Audience
This course is designed for backend developers, software engineers, and technical professionals with a basic understanding of Python and web development. Familiarity with REST APIs and fundamental database concepts is recommended.
About the Author
Jose Salvatierra Fuentes: Jose Salvatierra is the founder of Teclado and a seasoned software engineer with over seven years of experience in online teaching. Passionate about helping students learn to code, Jose aims to demystify software development and make it accessible to everyone. His teaching philosophy focuses on ensuring students truly understand the intricacies of coding, making the learning process intuitive and rewarding. Specializing in Python and JavaScript, Jose is adept in web and backend development, utilizing frameworks such as Flask, React, React Native, and AngularJS. He also has extensive experience with UNIX systems, MongoDB, PostgreSQL, and advanced system architecture design.
Table of contents
- Chapter 1 : Course Introduction
- Chapter 2 : Working with FastAPI
- Chapter 3 : Introduction to pytest
-
Chapter 4 : Working with async databases
- Introduction to working with databases
- Installing requirements for async databases in FastAPI
- Creating a config file using Pydantic
- Different configurations per environment
- Config caching and how to get the config object
- Async database setup with FastAPI
- Database connection with lifespan events in FastAPI
- Run your FastAPI test in 'test' mode
- Using a database in our FastAPI router
-
Chapter 5 : Logging in FastAPI applications
- Introduction to logging
- Python logging: loggers, handlers, and formatters
- Logger hierarchies and name
- Adding Logging Configuration for FastAPI Applications
- How to configure multiple loggers in the logging module
- Adding File Handlers for Saving Logs
- Add logging to your FastAPI endpoints
- Python logging: filters and custom filters
- Logging HTTPExceptions with an Exception Handler
- Identifying logs from the same request: Correlation ID
- Adding JSON-formatted log files
- Obfuscating email addresses in logs using a custom filter
- Adding Logtail for Cloud Logging in FastAPI
- Enabling Logtail only in production
-
Chapter 6 : User authentication with FastAPI
- Introduction to user authentication
- Installing requirements and, what are JWTs?
- Adding a users table and retrieving users by email
- Adding user registration and tests
- Adding tests for the user registration endpoint
- How to hash passwords with passlib
- Generate the access token
- Retrieve the current user with their token
- Use the current user in the API router
- Dependency injection: getting the user
- Adding user relationships to other tables
- (Optional) OAuth Password Bearer and Swagger Auth
- Chapter 7 : Many-to-many relationships
-
Chapter 8 : User email confirmation
- Creating the confirmation token
- Decoding the confirmation token
- Adding a user confirmation endpoint
- Requiring user confirmation for authenticated requests
- Mailgun set-up and configuration
- Sending emails and testing with Python
- Sending a confirmation email on registration
- Sending emails with background tasks
- Chapter 9 : File Uploads with FastAPI
- Chapter 10 : Background Tasks for Image Generation
- Chapter 11 : FastAPI Deployments and Application Management
Product information
- Title: Mastering REST APIs with FastAPI
- Author(s):
- Release date: June 2024
- Publisher(s): Packt Publishing
- ISBN: 9781835464694
You might also like
video
REST APIs with Flask and Python in 2024
A REST API is an application that accepts data from clients and returns data back. For …
book
Building Python Web APIs with FastAPI
Discover FastAPI features and best practices for building and deploying high-quality web APIs from scratch Key …
book
Mastering API Architecture
Most organizations with a web presence build and operate APIs; the doorway for customers to interact …
video
Docker for the Absolute Beginner - Hands-On
Docker is an open platform for developers and sysadmins to build, deploy, and run distributed applications …