Login

Lost your password?
Don't have an account? Sign Up

Python API Development – Comprehensive Course for Beginners

Learn Python API development in one of the most comprehensive courses ever on the topic. You will build a full-fledged API in Python using FastAPI. You will learn the fundamentals of API design including routes, serialization/deserialization, schema validation, and models. You will also learn about SQL, testing with pytest, and how to build out a CI/CD pipeline using GitHub actions.

? Code:

✏️ Course from Sanjeev Thiyagarajan. Check out his channel:

⭐️ Course Contents
00:00 Intro
06:33 Project Overview
11:22 Mac Python Installation
13:15 Mac VS Code install and setup
16:37 Windows Python Installation
18:30 Windows VS Code install and setup
22:11 Python virtual Env Basics
24:35 Virtual Env on windows
28:56 Virtual Env on Mac
34:17 Install dependencies w/ pip
36:21 Starting FastAPI
39:23 Path Operations
53:22 Intro toman
57:34 HTTP Requests
1:07:29 Schema Validation with Pydantic
1:22:45 CRUD Operations
1:29:44 Storing in Array
1:34:06 Creating
1:38:15 Postman Collections & saving requests
1:39:47 Retrieve One
1:48:10 Path order Matters
1:52:46 Changing response Status Codes
2:01:49 Deleting
2:10:31 Updating
2:18:02 Automatic Documentation
2:21:34 Python packages
2:24:11 Database Intro
2:28:54 Postgres Windows Install
2:31:28 Postgres Mac Install
2:34:26 Database Schema & Tables
2:44:35 Managing Postgres with PgAdmin GUI
3:12:10 Your first SQL Query
3:19:43 Filter results with "where"
3:22:55 SQL Operators
3:26:38 IN
3:28:07 Pattern matching with LIKE
3:31:59 Ordering Results
3:36:27 LIMIT & OFFSET
3:39:21 Modifying Data
3:53:48 Setup App Database
3:58:21 Connecting to database w/ Python
4:08:00 Database CRUD
4:31:18 ORM intro
4:35:33 SQLALCHEMY setup
4:55:25 Adding CreatedAt Column
5:00:59 Get All
5:07:55 Create
5:15:50 Get by ID
5:19:50 Delete
5:22:31 Update
5:28:21 Pydantic vs ORM Models
5:32:21 Pydantic Models Deep Dive
5:38:57 Response Model
5:50:08 Creating Users Table
5:54:50 User Registration Path Operation
6:03:27 Hashing Passwords
6:08:49 Refractor Hashing Logic
6:10:32 Get User by ID
6:17:13 FastAPI Routers
6:27:34 Router Prefix
6:30:31 Router Tags
6:32:49 JWT Token Basics
6:47:03 Login Process
7:00:44 Creating Token
7:09:58 OAuth2 PasswordRequestForm
7:13:23 Verify user is Logged In
7:25:21 Fixing Bugs
7:27:59 Protecting Routes
7:36:17 Test Expired Token
7:38:13 Fetching User in Protected Routes
7:42:44 Postman advanced Features
7:50:33 SQL Relationship Basics
7:54:59 Postgres Foreign Keys
8:07:20 SQLAlchemy Foreign Keys
8:13:40 Update Schema to include User
8:17:59 Assigning Owner id when creating new
8:21:01 Delete and Update only your own
8:27:48 Only Retrieving Logged in User's
8:33:37 Sqlalchemy Relationships
8:38:32 Query Parameters
8:50:46 Cleanup our main.py file
8:53:53 Env Variables
9:21:20 Vote/Like Theory
9:26:36 Votes Table
9:31:33 Votes Sqlalchemy
9:34:11 Votes Route
9:52:31 SQL Joins
10:15:26 Joins in SqlAlchemy
10:28:21 Get One with Joins
10:30:18 What is a database migration tool
10:33:45 Alembic Setup
11:13:50 Disable SqlAlchemy create Engine
11:14:28 What is CORS?
11:23:38 Git PreReqs
11:27:40 Git Install
11:29:23 Github
11:34:39 Heroku intro
11:35:40 Create Heroku App
11:40:21 Heroku procfile
11:44:59 Adding a Postgres database
11:48:42 Env Variables in Heroku
11:58:59 Alembic migrations on Heroku Postgres instance
12:02:52 Pushing changed to production
12:05:04 Create an Ubuntu VM
12:08:04 Update packages
12:10:47 Install Python
12:12:21 Install Postgres & setup password
12:17:28 Postgres Config
12:24:50 Create new user and setup python evironment
12:34:06 Env Variables
12:42:24 Alembic migrations on production database
12:45:57 Gunicorn
12:54:12 Creating a Systemd service
13:04:45 NGINX
13:10:45 Setting up Domain name
13:15:19 SSL/HTTPS
13:19:31 NGINX enable
13:20:06 Firewall
13:23:47 Pushing code changes to Production
13:26:09 Dockerfile
13:38:39 Docker Compose
13:48:34 Postgres Container
13:56:22 Bind Mounts
14:03:39 Dockerhub
14:08:08 Production vs Development
14:14:51 Testing Intro
14:17:19 Writing your first test
14:30:22 The -s & -v flags
14:31:44 Testing more functions
14:35:29 Parametrize
14:40:21 Testing Classes
14:48:37 Fixtures
14:55:40 Combining Fixtures + Parametrize
14:59:13 Testing Exceptions
15:06:07 FastAPI TestClient
15:14:26 Pytest flags
15:17:31 Test create user
15:25:23 Setup testing database
15:36:47 Create & destroy database after each test
15:44:18 More Fixtures to handle database interaction
15:50:35 Trailing slashes in path
15:53:12 Fixture scope
16:07:50 Test user fixture
16:14:40 Test/validate token
16:18:59 Conftest.py
16:22:09 Testing
17:34:15 CI/CD intro
17:43:29 Github Actions
17:49:32 Creating Jobs
17:57:38 setup python/dependencies/pytest
18:06:14 Env variables
18:11:19 Github Secrets
18:18:14 Testing database
18:23:42 Building Docker images
18:34:33 Deploy to heroku
18:49:10 Failing tests in pipeline
18:52:18 Deploy to Ubuntu

https://www.educational.guru

57 comments

    1. Daniel Simamora

      has anyone finished this? how was it? is it suitable for me who only knows Python?
      well, I know some HTML CSS JS to build simple website. because Im trying to deploy my Machine Learning project which is from Python libraries, into a sort of simple web app…

  1. Maher Turifi

    Timestamps for entire course(this is copied from by Sanjeev Thiyagarajan video in his channel):

    -Section 1 – Intro—
    Course Project
    00:10 – Course Intro
    06:33 – Course Project Overview

    Section 2 – Setup & installation——–
    11:22 – Mac Python Installation
    13:15 – Mac Vscode install and setup
    16:37 – Windows Python Installation
    18:30 – Windows vscode install and setup
    22:11 – Python virtual environment Basics
    24:35 – Virtual environment on windows
    28:56 – Virtual environment on Mac

    — Section 3 FastApi————————-
    34:17 – 10 Install dependencies w/ pip
    36:21 – 11 starting fastapi
    39:23 – 12. path operations
    48:25 – 13 Path Operation Order(yes it matters)
    53:22 – 14 Intro to Postman
    57:34 – 15 HTTP Post Requests
    01:07:29 – 16 Schema Validation with Pydantic
    01:22:45 – 17 CRUD Operations
    01:29:44 – 18 storing posts in Array
    01:34:06 – 19 creating posts
    01:38:15 – 20 Postman Collections & saving requests
    01:39:47 – 21 Retrieve One Post
    01:48:10 – 22 Path order Matters
    01:52:46 – 23 Changing response Status Codes
    02:01:49 – 24 Deleting Posts
    02:10:31 – 25 Updating Posts
    02:18:02 – 26 Automatic Documentation
    02:21:34 – 27 Python packages

    ——– Section 4 Databases—————
    02:24:11 – 28 Database Intro
    02:28:54 – 29 Postgres Windows Install
    02:31:28 – 30 Postgres Mac Install
    02:34:26 – 31 Database Schema & Tables
    02:44:35 – 32 Managing Postgres with PgAdmin GUI
    03:12:10 – 33 Your first SQL Query
    03:19:43 – 34 Filter results with “where” keyword
    03:22:55 – 35 SQL Operators
    03:26:38 – 36 IN Keyword
    03:28:07 – 37 Pattern matching with LIKE keyword
    03:31:59 – 38 Ordering Results
    03:36:27 – 39 LIMIT & OFFSET
    03:39:21 – 40 Inserting Data
    03:47:07 – 41 Deleting Data
    03:49:57 – 42 Updating Data

    ——–Section 5 Python + Raw SQL —————————–
    03:53:48 – 43 Setup App Database
    03:58:21 – 44 Connecting to database w/ Python
    04:08:00 – 45 Retrieving Posts
    04:11:35 – 46 Creating Post
    04:19:17 – 47 Get One Post
    04:24:12 – 48 Delete Post
    04:26:30 – 49 Update Post

    ———Section 6 ORMs —————————–
    04:31:18 – 50 ORM intro
    04:35:33 – 50 SQLALCHEMY setup
    04:55:25 – 51 Adding CreatedAt Column
    05:00:59 – 52 Get All Posts
    05:07:55 – 53 Create Posts
    05:15:50 – 54 Get Post by ID
    05:19:50 – 55 Delete Post
    05:22:31 – 56 Update Post

    ————Section 7 Pydantic Models ————–
    05:28:21 – 57 Pydantic vs ORM Models
    05:32:21 – 58 Pydantic Models Deep Dive
    05:38:57 – 59 Response Model

    ———–Section 8 Authentication & Users ——-
    05:50:08 – 63 Creating Users Table
    05:54:50 – 64 User Registration Path Operation
    06:03:27 – 65 Hashing User Passwords
    06:08:49 – 66 Refractor Hashing Logic
    06:10:32 – 67 Get User by ID
    06:17:13 – 68 FastAPI Routers
    06:27:34 – 69 Router Prefix
    06:30:31 – 70 Router Tags
    06:32:49 – 80 JWT Token Basics
    06:47:03 – 81 Login Process
    07:00:44 – 82 Creating a Token
    07:09:58 – 83 OAuth2 PasswordRequestForm
    07:13:23 – 84 Verify user is Logged In
    07:25:21 – 85 Fixing Bugs
    07:27:59 – 86 Protecting Routes
    07:36:17 – 87 Test Expired Token
    07:38:13 – 88 Fetching User in Protected Routes
    07:42:44 – 89 Postman advanced Features

    ————–Section 9 Relationships——————-
    07:50:33 – 90 SQL Relationship Basics
    07:54:59 – 91 Postgres Foreign Keys
    08:07:20 – 92 SQLAlchemy Foreign Keys
    08:13:40 – 93 Update Post Schema to include User
    08:17:59 – 94 Assigning Owner id when creating new post
    08:21:01 – 95 Delete and Update only your own posts
    08:27:48 – 96 Only Retrieving Logged in User’s posts
    08:33:37 – 97 Sqlalchemy Relationships
    08:38:32 – 98 Query Parameters
    08:50:46 – 99 Cleanup our main.py file
    08:53:53 – 100 Environment Variables

    ————–Section 10 Vote/Like System ———
    09:21:20 – 101 Vote/Like Theory
    09:26:36 – 102 Votes Table
    09:31:33 – 103 Votes Sqlalchemy
    09:34:11 – 104 Votes Route
    09:52:31 – 105 SQL Joins
    10:15:26 – 106 Joins in SqlAlchemy
    10:28:21 – 107 Get One Post with Joins

    ————–Section 11 Database Migration w/ Alembic————
    10:30:18 – 108 What is a database migration tool
    10:33:45 – 109 Alembic Setup
    10:42:29 – 110 Alembic First Revision
    10:51:49 – 111 Alembic Rollback database Schema
    10:56:27 – 112 Alembic finishing up the rest of the schema
    11:13:50 – 113 Disable SqlAlchemy create Engine

    —————Section 12 Pre Deployment Checklist —————–
    11:14:28 – 114 What is CORS?????
    11:23:38 – 115 Git PreReqs
    11:27:40 – 116 Git Install
    11:29:23 – 117 Github

    —————Section 13 Deployment Heroku—————————–
    11:34:39 – 118 Heroku intro
    11:35:40 – 119 Create Heroku App
    11:40:21 – 120 Heroku procfile
    11:44:59 – 121 Adding a Postgres database
    11:48:42 – 122 Environment Variables in Heroku
    11:58:59 – 123 Alembic migrations on Heroku Postgres instance
    12:02:52 – 124 Pushing changed to production

    ————–Section 14 Deployment Ubuntu——————————-
    12:05:04 – 125 Create an Ubuntu VM
    12:08:04 – 126 Update packages
    12:10:47 – 127 Install Python
    12:12:21 – 128 Install Postgres & setup password
    12:17:28 – 129 Postgres Config
    12:24:50 – 130 Create new user and setup python evironment
    12:34:06 – 131 Environment Variables
    12:42:24 – 132 Alembic migrations on production database
    12:45:57 – 133 Gunicorn
    12:54:12 – 134 Creating a Systemd service
    13:04:45 – 135 NGINX
    13:10:45 – 136 Setting up Domain name
    13:15:19 – 137 SSL/HTTPS
    13:19:31 – 138 NGINX enable
    13:20:06 – 139 Firewall
    13:23:47 – 140 Pushing code changes to Production

    —————Section 15 Docker—————————————
    13:26:09 – 141 Dockerfile
    13:38:39 – 142 Docker Compose
    13:48:34 – 143 Postgres Container
    13:56:22 – 144 Bind Mounts
    14:03:39 – 145 Dockerhub
    14:08:08 – 146 Production vs Development

    —————Section 16 Testing————————————–
    14:14:51 – 147 Testing Intro
    14:17:19 – 148 Writing your first test
    14:30:22 – 149 The -s & -v flags
    14:31:44 – 150 Testing more functions
    14:35:29 – 160 Parametrize
    14:40:21 – 170 Testing Classes
    14:48:37 – 171 Fixtures
    14:55:40 – 172 Combining Fixtures + Parametrize
    14:59:13 – 173 Testing Exceptions
    15:06:07 – 174 FastAPI TestClient
    15:14:26 – 175 Pytest flags
    15:17:31 – 176 Test create user
    15:25:23 – 177 Setup testing database
    15:36:47 – 178 Create & destroy database after each test
    15:44:18 – 179 More Fixtures to handle database interaction
    15:50:35 – 180 Trailing slashes in path
    15:53:12 – 181 Fixture scope
    16:07:50 – 182 Test user fixture
    16:14:40 – 183 Test/validate token
    16:18:59 – 184 Conftest.py
    16:22:09 – 185 Failed login test
    16:27:42 – 186 Get all posts test
    16:35:20 – 187 Posts fixture to create test posts
    16:51:15 – 188 Unauthorized Get Posts test
    16:52:35 – 189 Get one post test
    16:59:11 – 190 Create post test
    17:07:48 – 191 Delete post test
    17:15:06 – 192 Update post
    17:21:52 – 193 Voting tests

    —————-Section 17 CI/CD pipeline———————-
    17:34:15 – CI/CD intro
    17:43:29 – Github Actions
    17:49:32 – Creating Jobs
    17:57:38 – setup python/dependencies/pytest
    18:06:14 – Environment variables
    18:11:19 – Github Secrets
    18:18:14 – Testing database
    18:23:42 – Building Docker images
    18:34:33 – Deploy to heroku
    18:49:10 – Failing tests in pipeline
    18:52:18 – Deploy to Ubuntu

    1. Daniel Simamora

      have you finished this? how was it? is it suitable for me who only knows Python?
      well, I know some HTML CSS JS to build simple website. because Im trying to deploy my Machine Learning project which is from Python libraries, into a sort of simple web app…

    1. Daniel Simamora

      @The Blind Programmer well, first im a beginner and a non computer science student, I learn this on initiative.

      I build it in jupyter notebook and google colab, which is fully Python. So I’m already able to give input, process it (like transform data, split it, and train it), and give the output.

      but you know it’s still a notebook. I want to build a web app, so it’s become interactive, and much better to deploy and host it so I can share it with new friends.

      my knowledge in web dev is some HTML, CSS, JS, PHP, MySQL. And currently learning this FastAPI. My knowledge is still like scratching the surface though.

      thank you for your support ?

    1. Dheeraj

      I am getting this error
      pydantic.error_wrappers.ValidationError: 1 validation error for Token
      response -> acccess_token
      field required (type=value_error.missing)
      can you please help me regarding this issue

    2. Avner Volpert

      @Red Pickle Hi, not sure if it is still relevant for you, but the name of the property of the schema you use is the same label you user in the query.

      So if you decide to label the vote count as “Votes”, the schema property should be Votes.
      you can try and change the label and see that it is the deciding factor.

      Hope it helps you or anyone else with this issue

  2. Anuj Patel

    Truly incredible content. I’m currently a CS student and found this free course more helpful and practical than most of my classes. I really appreciate all the hard work Sanjeev and the team put into this; you guys are amazing!

  3. itarukmakto

    Finally finished it. Amazing experience. So thorough. The style of trying and committing errors and correcting it on the fly by suggesting alternatives and making us part of his thinking process to fix the errors was very helpful. The only thing missing was if he could have added a basic UI for the social media post with a simple frontend(React.js ?) would have made this tutorial a full package. But hey it can be an assignment for me to try that part. Have been hearing this man’s voice daily a little for over a month and now feels strange that I’ll miss it.

  4. An Ro

    Amazement course! Thanks very much for this breathtaking journey!
    16:44:00 Perhaps my version of the “posts_data” transformation instead of map will be useful to someone: “posts = [models.Post(**post) for post in posts_data]” . The list comprehension is generally more concise and easier to read.

  5. Luca Dalla Valle

    For those wondering, at 10:15:39, the bug was that he made the class PostOut inherit from PostBase instead of BaseModel. It was throwing errors because Pydantic was expecting all the members of class PostBase to be present in the object returned by the API.

    1. Dheeraj

      I am getting this error
      pydantic.error_wrappers.ValidationError: 1 validation error for Token
      response -> acccess_token
      field required (type=value_error.missing)
      can you please help me regarding this issue

    2. Daniel Simamora

      @Luca Dalla Valle i used Python a lot just in data science and machine learning related libraries, like pandas numpy sklearn tensorflow and some others. But never had experience for webdev, like django, flask, and fastapi. My understanding in other website language like html css JS PHP are still on the surface.

      but i need to do my school project. where I deploy my ML (which I mostly done only in Jupyter Notebook or Google Colab, which is not attractive), so I can make a simple web app….

    3. Luca Dalla Valle

      @Daniel Simamora I think the course is well worth your time if you never used python in a real-world project. I have skipped the deploy part btw. I also suggest to watch in 1.25x or even 1.50x

    4. Daniel Simamora

      have you finished this course? how was it? is it suitable for me who only knows Python?
      well, I know some HTML CSS JS to build simple website. because Im trying to deploy my Machine Learning project which is from Python libraries, into a sort of simple web app…

    1. sahil kumar

      @IMRAN YOUNUS bro you should start applying, even if it is not enough at least you will get to know what is missing or lacking. An intern should not and will not know everything, there is a reason they’re looking for an intern, not an FTE.

  6. Joe G

    I was struggling for the first hour to set up those things. now, 4 hours and keep going.
    my feeling: every word, and explanation is precise and easy to follow, I may not judge it’s the best practice but this is actually the comprehensive way to get started to learn from 0. Many thanks to Sanjeev Thiyagarajan !!

  7. Skirge ZA

    Great course, lots of valuable info. Also appreciate keeping things like 3:31:49 in, the random things that happen to everyone we don’t always get. Here, for those wondering, he highlighted some text before running the query, that’s why he got the syntax error, as it was only running the highlighted part.

  8. Alexis Ruessmann

    This is just amazing, personally, outside of FastAPI I already knew a bit of everything but seeing it all in action together and not taught as if it’s its own world makes it even more complete and understandable! This channel is a real treasure and this video especially!!

  9. Arsive_ _play

    I am still around 11 hrs into this course but I can truly tell the difference in the contents. I like how this course not only offers what’s in the title but also a complete package from scratch. Especially with the SQL, alembic, git and other tools. Thanks a lot. I have learned so much till now with this course. Truly appreciate the effort.

  10. Medha Tyagi

    This is an amazing course. Sanjeev has really done a good job to explain all the conepts very clearly. Although it is a 19 hour course, but it is so engaging that you just go with the flow.

Leave a Comment

Your email address will not be published. Required fields are marked *

*
*