REST APIs with Flask and Python

REST APIs with Flask and Python
REST APIs with Flask and Python
English | MP4 | AVC 1920×1080 | AAC 48KHz 2ch | 13.5 Hours | 1.96 GB

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

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, nginx, and Varnish.

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.
Table of Contents

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

A Full Python Refresher
6 Introduction to this section
7 Access the code for this section here
8 Variables in Python
9 Solution to coding exercise: Variables
10 Methods in Python
11 Solution to coding exercise: Methods
12 Lists, tuples, and sets
13 List, tuple, and set operations
14 Advanced set operations
15 Solution to coding exercise: Lists, tuples, sets
16 Loops in Python
17 If statements
18 Solution to coding exercise: Flow control
19 A programming exercise for you
20 List comprehension
21 Dictionaries
22 Are dictionaries "things"?
23 Solution to coding exercise: Dictionaries
24 Objects in Python
25 A Student example
26 Solution to coding exercise: Classes and objects
27 @classmethod and @staticmethod
28 Solution to coding exercise: @classmethod and @staticmethod
29 Inheritance in Object-Oriented Programming
30 *args and **kwargs
31 Passing functions as arguments
32 Decorators in Python
33 Advanced decorators
34 Conclusion of this section

Your first REST API
35 Introduction to this section
36 Installing Flask
37 Access the code for this section here
38 Your first Flask application
39 HTTP Verbs
40 REST Principles
41 Creating our application endpoints
42 Returning a list of stores
43 Implementing other endpoints
44 Calling the API from JavaScript
45 Using Postman for API testing
46 Conclusion of this section

Flask-RESTful for more efficient development
47 Welcome to this section
48 Virtualenvs and setting up Flask-RESTful
49 Access the code for this section here
50 Your first Flask-RESTful app
51 Test-first API design—what is that?
52 Creating our Item Resource
53 The ItemList and creating Items
54 Improving code and error control
55 Authentication and logging in—part 1
56 Authentication and logging in—part 2
57 DELETE to delete Items
58 PUT to create or update Items
59 Advanced request parsing with Flask-RESTful
60 Optimising our final code and request parsing
61 Conclusion of this section

Storing resources in a SQL database
62 Welcome to this section
63 Setting up our project
64 Access the code for this section here
65 Running a SQLite database and interacting with it from Python
66 Logging in and retrieving Users from a database
67 Signing up and writing Users to a database
68 Preventing duplicate usernames when signing users up
69 Retrieving our Item resources from a database
70 Writing our Item resources to a database
71 Deleting our Item resources from the database
72 Refactoring insertion of items
73 The PUT method with database interaction
74 Retrieving many items from the database
75 Conclusion of this section

Simplifying storage with Flask-SQLAlchemy
76 Welcome to this section!
77 Access the code for this section here
78 Setting up this section's project
79 Improving the project structure and maintainability
80 Creating User and Item models
81 Verifying the app works after our changes
82 Advanced Postman: environments and tests
83 Telling SQLAlchemy about our tables and columns
84 Implementing the ItemModel using SQLAlchemy
85 Implementing the UserModel using SQLAlchemy
86 Easily displaying the ItemList resource with SQLAlchemy
87 No more creating tables manually—telling SQLAlchemy to create tables
88 Creating a new model: StoreModel
89 Creating the Store Resource
90 Final testing of this section's API
91 Conclusion of this section

Git—version control
92 Welcome to this section
93 Installing Git on Mac and Windows
94 What is a Git repository?
95 The Git workflow—part 1
96 The Git workflow—part 2, including GitHub
97 Using SSH keys for security
98 The README file
99 Conclusion of this section

Deploying Flask apps to Heroku
100 Welcome to this section
101 Access the code for this section here
102 What is Heroku?
103 Getting our code into GitHub
104 Setting up Heroku for Flask
105 Adding the required files to the project
106 Logs in Heroku and troubleshooting errors
107 Testing the deployed API with Postman
108 Adding PostgreSQL to our Heroku app
109 Working with Git and automatic deploys
110 Conclusion of this section

Deploying Flask apps to our own server
111 Welcome to this section
112 Setting up a DigitalOcean server
113 Installing PostgreSQL in Ubuntu 16.04
114 Creating a UNIX user in Ubuntu 16.04
115 Setting up our new user with PostgreSQL permissions
116 Setting up nginx and our REST API
117 Setting up uWSGI to run our REST API
118 Testing our API to make sure everything works
119 Conclusion of this section

Security in your REST APIs
120 Welcome to this section
121 Security in REST APIs e-book
122 Getting our domain name
123 Setting up Cloudflare
124 What is DNS?
125 Setting our DNS records
126 Verifying everything works—this is important!
127 Creating our SSL certificate in Cloudflare
128 Configuring nginx for SSL
129 Extra technical SSL resources
130 Conclusion of this section