Advanced REST APIs with Flask and Python

Video description

This Advanced REST API course takes your REST API development to a whole new level by familiarizing you with more of the Flask ecosystem. We start with a simple REST API and teach you everything you need to know about it. We introduce new features and technologies by baking them into this application so you can see how a professional REST API is developed. Every new feature is added to a fully working application and tested. We also help you understand more about how to build features incrementally so you can get them to your users quickly and minimize risk.

Remember, this is our most advanced course yet! You should have adequate programming experience with Python or another programming language. Some knowledge of how the web works will also be helpful.

You should have prior knowledge of how to install Python packages and how to run your Python applications. If you've used virtualenv or Pipenv before, that's excellent! Knowledge of how to use PyCharm for debugging is also a plus, although we cover using the debugger in the course!

What You Will Learn

  • Use Marshmallow for data serialization and deserialization
  • Send e-mails and user confirmations
  • Upload images, Database migrations
  • Easy ways to write documentation and test your API
  • Handle payments using Stripe
  • Third-party login using OAuth
  • Master software development, refactoring, debugging, and more!
  • Use the latest technologies and best practices.


This course is designed for software developers who want to add advanced functionality to REST APIs, backend developers interested in gaining knowledge of Flask and its ecosystem, and advanced developers of other programming languages who want to get up-to-speed quickly with advanced REST API development in Python

About The Author

Jos 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.

Publisher resources

Download Example Code

Table of contents

  1. Chapter 1 : Introduction
    1. Introduction to this section
    2. Our project and endpoints
    3. Reviewing the beginner course code
    4. Simplifying our error handling
    5. Refactoring our resources
    6. Should we have unique names?
    7. Adding basic type hinting
    8. Adding custom JSON types
    9. Using the current class as a type hint
    10. Using Black for code formatting
    11. Improving errors with constants
    12. @classmethod across the board
    13. Testing our API with Postman
    14. Conclusion of this section
  2. Chapter 2 : Serialization with Marshmallow
    1. Introduction to this section
    2. Serialization with Marshmallow
    3. Deserialization with Marshmallow
    4. Migrating from virtualenv to Pipenv
    5. Using vanilla Marshmallow with the API
    6. Introduction to Flask-Marshmallow
    7. Adding items to our REST API
    8. Adding stores to our REST API
    9. Deduplicating error handling
    10. Conclusion of this section
  3. Chapter 3 : E-mail confirmations
    1. Introduction to this section
    2. Introduction to e-mail confirmation
    3. Adding an activated property
    4. Activating users manually
    5. Telling users, they are active
    6. Setting up Mailgun
    7. Sending e-mails with Mailgun (Part 1)
    8. Sending e-mails with Mailgun (Part 2)
    9. Creating our Mailgun library file
    10. Using .env files in Flask
    11. Adding more configuration to. Env
    12. Error handling in Mailgun
    13. Conclusion of this section
  4. Chapter 4 : Advanced e-mail confirmation
    1. Introduction to this section
    2. Creating the Confirmation Model
    3. Changes in our User Model
    4. Creating our Confirmation Resource
    5. Updating our User Resource
    6. Adding the last confirmation to the user schema
    7. Fixing our
    8. Cross-resource dependencies are (generally) bad
    9. What are localisation and internationalisation?
    10. Storing strings in config files
    11. Creating a simple translation library
    12. Updating our resources to use translations
    13. Adding a new language to our API
    14. What is Flask-Babel?
    15. Common pitfalls and advice
    16. Conclusion of this section
  5. Chapter 5 : Postman documentation and tests
    1. Introduction to this section
    2. Collection and request descriptions
    3. Recap of Postman environments
    4. JavaScript tests in Postman
    5. Running entire collections in Postman
    6. Adding example requests and responses
    7. Previewing our Postman documentation
    8. Publishing our documentation page
    9. More options for publishing documentation
    10. Conclusion of this section
  6. Chapter 6 : Image uploads
    1. Introduction to this section
    2. Installing Flask-Uploads
    3. Config files in Flask
    4. What are wsgi and Werkzeug?
    5. Creating our image helper library
    6. Creating our image schema
    7. Creating our image upload resource
    8. Trying out our image upload
    9. Retrieving and deleting images
    10. Another example: user avatars
    11. Adding the avatar resource
    12. Conclusion of this section
  7. Chapter 7 : Database migrations
    1. Introduction to this section
    2. What's in our starter code?
    3. Connecting to our remote database
    4. Initialising Flask-Migrate and Alembic
    5. Creating our initial table structure
    6. Our first database migration
    7. Checking the Alembic script (important!)
    8. Adding a new column with migrations
    9. Problems that can happen while migrating
    10. A word of caution!
    11. Defining a SQLAlchemy naming convention
    12. When should you read documentation?
    13. Conclusion of this section
  8. Chapter 8 : Third party login with OAuth
    1. Introduction to this lecture
    2. Introduction to OAuth 2.0
    3. What's in our starter code?
    4. Creating a GitHub OAuth App
    5. Flask-OAuthlib
    6. Setting up our GitHub client
    7. Our GithubLogin resource
    8. What is Flask's g?
    9. What is a tokengetter?
    10. Finishing our GithubAuthorize resource
    11. Adding some error handling
    12. Setting user passwords
    13. Using url_for with Flask-RESTful
    14. Conclusion of this section
  9. Chapter 9 : Payments with Stripe
    1. Introduction to this section
    2. Setting up our Stripe account
    3. What's in our starter code?
    4. Where do users pay?
    5. After payment: receiving order data
    6. Creating our OrderModel
    7. Many-to-many relationships with SQLAlchemy
    8. Using the Association Object in our Resource
    9. Charging orders with Stripe
    10. Calculating the amount and description
    11. Testing our OrderResource
    12. Creating a way to view existing orders
    13. When things go wrong: error handling in Stripe
    14. Security considerations in payments
    15. Conclusion of this section
  10. Chapter 10 : Bonus section
    1. Conclusion of the course

Product information

  • Title: Advanced REST APIs with Flask and Python
  • Author(s): Jose Salvatierra
  • Release date: August 2019
  • Publisher(s): Packt Publishing
  • ISBN: 9781839215810