REST APIs with Flask and Python

REST APIs with Flask and Python
REST APIs with Flask and Python
English | MP4 | AVC 1280×720 | AAC 44KHz 2ch | 17 Hours | 3.71 GB

Build professional REST APIs with Python, Flask, Flask-RESTful, and Flask-SQLAlchemy

Are you tired of boring, outdated, incomplete, or incorrect tutorials? I say no more to copy-pasting code that you don’t understand.

Welcome to one of the best resources online on creating REST APIs. I’m Jose, and I’m a software engineer; here to help you truly understand and develop your skills in web and REST API development with Python.

Production-ready REST APIs

This course will guide you in creating simple, intermediate, and advanced REST APIs including authentication, deployments, caching, and much more.

We’ll start with a Python refresher that will take you from the very basics to some of the most advanced features of Python—for you to never be lost or confused.

Using Flask and popular extensions Flask-RESTful, Flask-JWT, and Flask-SQLAlchemy we will dive right into developing complete, solid, production-ready REST APIs.

We will also look into essential technologies Git, Heroku, and nginx.

You’ll be able to…

  • Create resource-based, production-ready REST APIs using Flask and popular extensions;
  • Using SQLAlchemy to easily and efficiently store resources to a database; and
  • Understand the complex intricacies of deployments and performance of REST APIs.

What you’ll learn

  • Connect web or mobile applications to databases and servers via REST APIs
  • Create secure and reliable REST APIs which include authentication, logging, caching, and more
  • Understand the different layers of a web server and how web applications interact with each other
  • Handle seamless user authentication with advanced features like token refresh
  • Handle log-outs and prevent abuse in your REST APIs with JWT blacklisting
  • Develop professional-grade REST APIs with expert instruction
Table of Contents

Welcome!
1 How to take this course
2 Before we get started: a self-assessment
3 Python on Windows
4 Python on Mac

A Full Python Refresher
5 Introduction to this section
6 Access the code for this section here
7 Variables in Python
8 Solution to coding exercise: Variables
9 String formatting in Python
10 Getting user input
11 Writing our first Python app
12 Lists, tuples, and sets
13 Advanced set operations
14 Solution to coding exercise: Lists, tuples, sets
15 Booleans in Python
16 If statements
17 The ‘in’ keyword in Python
18 If statements with the ‘in’ keyword
19 Loops in Python
20 Solution to coding exercise: Flow control
21 List comprehensions in Python
22 Dictionaries
23 Destructuring variables
24 Functions in Python
25 Function arguments and parameters
26 Default parameter values
27 Functions returning values
28 Solution to coding exercise: Functions
29 Lambda functions in Python
30 Dictionary comprehensions
31 Solution to coding exercise: Dictionaries
32 Unpacking arguments
33 Unpacking keyword arguments
34 Object-Oriented Programming in Python
35 Magic methods: __str__ and __repr__
36 Solution to coding exercise: Classes and objects
37 @classmethod and @staticmethod
38 Solution to coding exercise: @classmethod and @staticmethod
39 Class inheritance
40 Class composition
41 Type hinting in Python 3.5+
42 Imports in Python
43 Relative imports in Python
44 Errors in Python
45 Custom error classes
46 First-class functions
47 Simple decorators in Python
48 The ‘at’ syntax for decorators
49 Decorating functions with parameters
50 Decorators with parameters
51 Mutability in Python
52 Mutable default parameters (and why they’re a bad idea)
53 Conclusion of this section

Your first REST API
54 Introduction to this section
55 What is an API?
56 Installing Flask
57 Access the code for this section here
58 Your first Flask application
59 HTTP Verbs
60 REST Principles
61 Creating our application endpoints
62 Returning a list of stores
63 Implementing other endpoints
64 Calling the API from JavaScript
65 Using Postman for API testing
66 Conclusion of this section

Flask-RESTful for more efficient development
67 Welcome to this section
68 Virtualenvs and setting up Flask-RESTful
69 Access the code for this section here
70 Your first Flask-RESTful app
71 Test-first API design—what is that?
72 Creating our Item Resource
73 The ItemList and creating Items
74 Improving code and error control
75 Authentication and logging in—part 1
76 Authentication and logging in—part 2
77 DELETE to delete Items
78 PUT to create or update Items
79 Advanced request parsing with Flask-RESTful
80 Optimising our final code and request parsing
81 Conclusion of this section

Storing resources in a SQL database
82 Welcome to this section
83 Setting up our project
84 Access the code for this section here
85 Running a SQLite database and interacting with it from Python
86 Logging in and retrieving Users from a database
87 Signing up and writing Users to a database
88 Preventing duplicate usernames when signing users up
89 Retrieving our Item resources from a database
90 Writing our Item resources to a database
91 Deleting our Item resources from the database
92 Refactoring insertion of items
93 The PUT method with database interaction
94 Retrieving many items from the database
95 Advanced Flask-JWT Configuration
96 Conclusion of this section

Simplifying storage with Flask-SQLAlchemy
97 Welcome to this section!
98 Access the code for this section here
99 Setting up this section’s project
100 Improving the project structure and maintainability
101 Creating User and Item models
102 Verifying the app works after our changes
103 Advanced Postman: environments and tests
104 Telling SQLAlchemy about our tables and columns
105 Implementing the ItemModel using SQLAlchemy
106 Implementing the UserModel using SQLAlchemy
107 Easily displaying the ItemList resource with SQLAlchemy
108 No more creating tables manually—telling SQLAlchemy to create tables
109 Creating a new model: StoreModel
110 Creating the Store Resource
111 Final testing of this section’s API
112 Conclusion of this section

Git—version control
113 Welcome to this section
114 Installing Git on Mac and Windows
115 What is a Git repository?
116 The Git workflow—part 1
117 The Git workflow—part 2, including GitHub
118 Using SSH keys for security
119 The README file
120 Conclusion of this section

Deploying Flask apps to Heroku
121 Welcome to this section
122 Access the code for this section here
123 What is Heroku?
124 Getting our code into GitHub
125 Setting up Heroku for Flask
126 Adding the required files to the project
127 Logs in Heroku and troubleshooting errors
128 Testing the deployed API with Postman
129 Adding PostgreSQL to our Heroku app
130 Working with Git and automatic deploys
131 Conclusion of this section

Deploying Flask apps to our own server
132 Welcome to this section
133 Setting up a DigitalOcean server
134 Want to deploy to AWS?
135 Installing PostgreSQL in Ubuntu 16.04
136 Creating a UNIX user in Ubuntu 16.04
137 Setting up our new user with PostgreSQL permissions
138 Setting up nginx and our REST API
139 Setting up uWSGI to run our REST API
140 Testing our API to make sure everything works
141 Conclusion of this section

Security in your REST APIs
142 Welcome to this section
143 Security in REST APIs e-book
144 Getting our domain name
145 Setting up Cloudflare
146 What is DNS?
147 Setting our DNS records
148 Verifying everything works—this is important!
149 Creating our SSL certificate in Cloudflare
150 Configuring nginx for SSL
151 Extra technical SSL resources
152 Conclusion of this section

Token refreshing and Flask-JWT-Extended
153 Welcome to this section
154 A recap of the code + a few changes!
155 Creating a User Resource for testing
156 Testing our new Resource with Postman
157 Logging in with Flask-JWT-Extended
158 Testing the login with Postman
159 Adding JWT Claims
160 Getting the JWT identity in and endpoint and @jwt_optional
161 What is a fresh token?
162 Performing token refresh in our REST API
163 Requiring a fresh token in an endpoint
164 Customizing Flask-JWT-Extended callbacks and responses
165 Blacklisting with Flask-JWT-Extended
166 Logging users out in our REST API
167 E-book: complete review of the API so far
168 Flask-JWT-Extended further reading

Bonus Section
169 Bonus lecture: other courses and next steps