Video description
A REST API is an application that accepts data from clients and returns data back. For example, a REST API could accept text data from the client, such as a username and password, and return whether that is a valid user in the database.
The cover takes you through a Python refresher that will take you from the very basics to some of the most advanced features of Python—that’s all the Python you need to complete the course. Further, you will move on to create resource-based, production-ready REST APIs using Python, Flask, and popular Flask extensions.Learn to handle secure user registration and authentication with Flask. Learn to use SQLAlchemy and Flask-SQLAlchemy to easily and efficiently store resources in a database; understand the complex intricacies of deployments of Flask REST APIs.
You will also investigate essential technologies such as Git and database migrations with Alembic. Together, we will develop a REST API that not only allows clients to authenticate but also store and retrieve any data you want from a database. Learning this will help you develop any REST API that you need for your own projects!
By the end of the course, you will have understood and developed your skills in web and REST API development with Python, Flask, and Docker.
What You Will Learn
- Connect your web or mobile applications to databases and servers through REST APIs
- Create secure and reliable REST APIs
- Understand how web applications interact with each other
- Handle user authentication with advanced features such as token refresh
- Handle logouts in your REST APIs with JWT blacklisting
- Develop professional-grade REST APIs with expert guidance
Audience
This course is for students and software developers who want to enhance their mobile and web applications using server-side technologies or expand their skillset by learning how to develop professional-grade REST APIs. Those looking to explore Python for catering to web services specifically will also find this course useful. Familiarity with the basics of programming and knowledge of the Python programming language will help you grasp the concepts quickly.
About The Author
Jose Salvatierra Fuentes: Jose Salvatierra has been teaching online for over seven years, and he loves helping students learn to code and master software development. He founded Teclado to bring software development to everyone; his objective is for you to truly understand everything that goes on behind the scenes.
Coding is extremely rewarding. As you learn, things start to click and make sense. You can join the dots of all the things that weren’t quite clear before.
Jose can help you with Python and JavaScript issues, particularly in web and backend development. He is experienced with programming libraries and frameworks such as Flask, React, React Native, and AngularJS. He has worked extensively with UNIX systems, MongoDB, PostgreSQL, and advanced system architecture design.
Table of contents
- Chapter 1 : Welcome!
-
Chapter 2 : A Full Python Refresher
- Introduction to This Section
- Variables in Python
- Solution to Coding Exercise: Variables
- String Formatting in Python
- Getting User Input
- Writing Your First Python App
- Lists, Tuples, and Sets
- Advanced Set Operations
- Solution to Coding Exercise: Lists, Tuples, and Sets
- Booleans in Python
- If Statements
- The "in" Keyword in Python
- If Statements with the "in" Keyword
- Loops in Python
- Solution to Coding Exercise: Flow Control
- List Comprehensions in Python
- Dictionaries
- Destructuring Variables
- Functions in Python
- Function Arguments and Parameters
- Default Parameter Values
- Functions Returning Values
- Solution to Coding Exercise: Functions
- Lambda Functions in Python
- Dictionary Comprehensions
- Solution to Coding Exercise: Dictionaries and Students
- Unpacking Arguments
- Unpacking Keyword Arguments
- Object-Oriented Programming in Python
- Magic Methods: ..str.. and ..repr..
- Solution to Coding Exercise: Classes and Objects
- @classmethod and @staticmethod
- Solution to Coding Exercise: @classmethod and @staticmethod
- Class Inheritance
- Class Composition
- Type Hinting in Python 3.5+
- Imports in Python
- Relative Imports in Python
- Errors in Python
- Custom Error Classes
- First-Class Functions
- Simple Decorators in Python
- The "at" Syntax for Decorators
- Decorating Functions with Parameters
- Decorators with Parameters
- Mutability in Python
- Mutable Default Parameters (and Why They Are a Bad Idea)
- Chapter 3 : Your First REST API
- Chapter 4 : Introduction to Docker
-
Chapter 5 : Flask-Smorest for More Efficient Development
- Data Model Improvements for Our API
- General Improvements to Our First REST API
- New Endpoints for Our First REST API
- How to Run the API in Docker with Automatic Reloading and Debug Mode
- How to Use Blueprints and MethodViews in Flask
- How to Write Marshmallow Schemas for Our API
- How to Perform Data Validation with Marshmallow
- Decorating Responses with Flask-Smorest
-
Chapter 6 : Store Data in DQL Database with SQLAlchemy
- Overview and Why Use SQLAlchemy
- How to Code a Simple SQLAlchemy Model
- How to Write One-to-Many Relationships Using SQLAlchemy
- How to Configure Flask-SQLAlchemy with Your Flask App
- How to Insert Data into a Table Using SQLAlchemy
- How to Find Models in the Database by ID or Return a 404
- How to Update Models with SQLAlchemy
- How to Retrieve List of All Models
- How to Delete Models with SQLAlchemy
- Conclusion of This Section
- Chapter 7 : Many-to-Many Relationships with SQLAlchemy
-
Chapter 8 : User Authentication with Flask-JWT-Extended
- Who Uses the JWT?
- How to Set Up Flask-JWT-Extended with Our App
- Coding the User Model and Schema
- How to Add a Register Endpoint to the REST API
- How to Add a Login Endpoint to the REST API
- Protect Endpoints by Requiring a JWT
- JWT Claims and Authorization
- How to Add Logout to the REST API
- Request Chaining with Insomnia
- Token Refreshing with Flask-JWT-Extended
- Chapter 9 : Database Migrations with Alembic and Flask-Migrate
- Chapter 10 : Git Crash Course
- Chapter 11 : Deployments with Render.com
-
Chapter 12 : Task Queues with rq and Sending Emails
- How to Send Emails with Python and Mailgun
- How to Send Emails When Users Register
- What Is a Task Queue and Setting Up a Redis Database
- How to Populate and Consume the Task Queue with rq
- How to Process Background Tasks with the rq Worker
- How to Send HTML Emails Using Mailgun and Python
- How to Deploy a Background Worker to render.com
Product information
- Title: REST APIs with Flask and Python in 2023
- Author(s):
- Release date: December 2022
- Publisher(s): Packt Publishing
- ISBN: 9781788621526
You might also like
video
Advanced REST APIs with Flask and Python
This Advanced REST API course takes your REST API development to a whole new level by …
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
Python Testing with pytest
Test applications, packages, and libraries large and small with pytest, Python's most powerful testing framework. pytest …
video
Elasticsearch 8 and the Elastic Stack: In-Depth and Hands-On
Elasticsearch 8 is a powerful tool for analyzing big datasets in a matter of milliseconds! It’s …