A small repository of projects built in my course, REST APIs with Flask and Python.

Overview

REST APIs with Flask and Python

This repository contains code that is created in my course, REST APIs with Flask and Python.

The code is divided in folders, one for each section of the course which contains code.

Section 2

The code is in files numbered between 1 and 11, covering concepts ranging from beginner to advanced.

  1. Variables
  2. Methods
  3. Lists, tuples, and sets
  4. If statements
  5. List comprehension
  6. Dictionaries
  7. Classes and objects
  8. Static and class methods
  9. Args and Kwargs
  10. Passing functions as arguments
  11. Decorators

Section 3

The code in this section includes a simple Flask app and a HTML and JavaScript file which calls the Flask app endpoints.

Section 4

The code in this section includes a Flask app which is an API that represents items. It also includes user registration and authentication.

Section 5

The code in this section extends the last section by adding persistent storage of Items to a SQLite database.

Section 6

The code in this section extends the previous section by replacing the manual integration with SQLite, with SQLAlchemy—an ORM (Object-Relational Mapping)—which allows us to easily replace SQLite with something like PostgreSQL or MySQL.

Comments
  • Small typo in the

    Small typo in the "How To Deploy Python App Using uWSGI And Nginx" guide

    The guide is located here.

    After it is installed, we can create a virtualenv:

    virtualenv venv --python==python3.5

    From looking at the virtualenv documentation, I believe it should be a single equals sign in the command. virtualenv venv --python=python3.5

    This is a great guide, thank you!

    opened by davimiku 3
  • Added user logout using blacklist and revoking jit

    Added user logout using blacklist and revoking jit

    To perform user logout, it is recommended that we blacklist individual tokens (which can be identified with their unique jit) and keep track of them (normally in a database, but in this case in an in-memory set).

    Added a UserLogout resource and modified the blacklist loader slightly to achieve this.

    opened by jslvtr 3
  • build(deps): bump loader-utils from 2.0.2 to 2.0.3 in /docs

    build(deps): bump loader-utils from 2.0.2 to 2.0.3 in /docs

    Bumps loader-utils from 2.0.2 to 2.0.3.

    Release notes

    Sourced from loader-utils's releases.

    v2.0.3

    2.0.3 (2022-10-20)

    Bug Fixes

    • security: prototype pollution exploit (#217) (a93cf6f)
    Changelog

    Sourced from loader-utils's changelog.

    2.0.3 (2022-10-20)

    Bug Fixes

    • security: prototype pollution exploit (#217) (a93cf6f)
    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 2
  • Add lecture on cascade deletion and fix a couple issues

    Add lecture on cascade deletion and fix a couple issues

    New Content

    • ✨ #100 : add new lecture on cascading deletes (also on the Udemy course)
    • ✨ #101 : add insomnia export files so students can easily import them rather than having to create them manually for each section

    Updated Content

    • 🐛 #102
    opened by jslvtr 1
  • Fix dependencies and imports in SQL Storage section (s06)

    Fix dependencies and imports in SQL Storage section (s06)

    While recording the video on cascades, I noticed that flask-sqlalchemy was missing from the requirements.txt in every start/end folder of this section.

    Also, in models/__init__.py there were some extra imports that shouldn't have been there.

    opened by jslvtr 1
  • Release v2.2.0

    Release v2.2.0

    New Content

    • ✨ Added Insomnia export files per-section and for all sections, and e-book page to explain how to use them #92, #97

    Updated Content

    Improvements

    • 📊 Add links to Udemy course throughout e-book and some trial videos #89
    • 📊 Use Algolia search, update style of e-book and update Docusaurus version #96

    Bug fixes

    • 🐛 Added missing uuid import and fixed first few projects so code matches course #88
    • 🐛 Fix inconsistencies between video course and GitHub code #90
    • 🐛 Use db.Integer instead of db.String for foreign keys where required #91
    opened by jslvtr 1
  • feat(insomnia files): add info in e-book about insomnia exports

    feat(insomnia files): add info in e-book about insomnia exports

    This PR adds:

    • A callout at the beginning of each section to remind students about the Insomnia export files, which they can import so they don't have to create the Insomnia collections manually.
    • A new page, /insomnia-files/ in the e-book site that explains how to import and use the export files.

    Also, this PR removes the docs-upcoming folder which contained obsolete content.

    opened by jslvtr 1
  • Add links to Udemy course throughout e-book

    Add links to Udemy course throughout e-book

    In this PR I've added some embedded videos to the e-book as a preview of the Udemy Course for those students who are reading the e-book but haven't purchased the course. I've also added a few links to the Udemy Course, trying to be as unobtrusive as possible.

    opened by jslvtr 1
  • Release section on task queues and fix a few issues

    Release section on task queues and fix a few issues

    New Content

    • Section 12 on using task queues with rq to send emails through Mailgun, #83, #85

    Updated Content

    • Remove before_first_request in Flask apps, since now the recommended approach is to just do any necessary setup inside create_app(), #77
    • Remove db.create_all() from create_app() when using Flask-Migrate, since it is Flask-Migrate that creates the tables, #78
    • Add information to the e-book on how to make sure tag and item have the same store id when linking them, #79
    • Added missing required arguments in Flask-JWT-Extended callbacks, #81
    • Added missing hostname in the command to run Flask using the Flask development server in Docker, #82
    • Use FLASK_DEBUG instead of FLASK_ENV across entire ebook and all projects since FLASK_ENV is now deprecated, #84
    • Remove password's unique=True in all user models, #86
    opened by jslvtr 1
  • feat(rq): add section on task queues

    feat(rq): add section on task queues

    Adds an entirely new section and a few lectures!

    Task queues with rq and email sending

    • How to send emails with Python and Mailgun
    • Add email sending to our Flask API
    • What is a task queue?
    • Populate an rq task queue
    • How to run the rq background worker
    • How to send HTML emails using Mailgun
    opened by jslvtr 1
  • bug(docker): fix missing hostname when running flask in docker

    bug(docker): fix missing hostname when running flask in docker

    https://rest-apis-flask.teclado.com/docs/deploy_to_render/docker_with_gunicorn/

    This lecture was showing this command:

    docker run -dp 5000:5000 -w /app -v "$(pwd):/app" teclado-site-flask sh -c "flask run"
    

    But this should be this:

    docker run -dp 5000:5000 -w /app -v "$(pwd):/app" teclado-site-flask sh -c "flask run --host 0.0.0.0"
    

    Otherwise running the Flask app in development mode locally will work, but it will not be accessible from outside the container's network (i.e. you can't connect to it from the host).

    opened by jslvtr 1
  • build(deps): bump loader-utils from 2.0.2 to 2.0.4 in /docs

    build(deps): bump loader-utils from 2.0.2 to 2.0.4 in /docs

    Bumps loader-utils from 2.0.2 to 2.0.4.

    Release notes

    Sourced from loader-utils's releases.

    v2.0.4

    2.0.4 (2022-11-11)

    Bug Fixes

    v2.0.3

    2.0.3 (2022-10-20)

    Bug Fixes

    • security: prototype pollution exploit (#217) (a93cf6f)
    Changelog

    Sourced from loader-utils's changelog.

    2.0.4 (2022-11-11)

    Bug Fixes

    2.0.3 (2022-10-20)

    Bug Fixes

    • security: prototype pollution exploit (#217) (a93cf6f)
    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 1
  • build(deps): bump minimatch, recursive-readdir and serve-handler in /docs

    build(deps): bump minimatch, recursive-readdir and serve-handler in /docs

    Bumps minimatch, recursive-readdir and serve-handler. These dependencies needed to be updated together. Updates minimatch from 3.0.4 to 3.1.2

    Commits

    Updates recursive-readdir from 2.2.2 to 2.2.3

    Changelog

    Sourced from recursive-readdir's changelog.

    v2.2.3 - Mon, 19 Sep 2016 21:55:22 GMT

    v2.1.0 - Mon, 19 Sep 2016 21:55:22 GMT

    v2.0.0 - Wed, 06 Apr 2016 04:31:02 GMT

    v1.3.0 - Wed, 14 Oct 2015 14:35:55 GMT

    v1.2.1 - Wed, 14 Jan 2015 16:49:55 GMT

    Commits
    Maintainer changes

    This version was pushed to npm by bnb, a new releaser for recursive-readdir since your current version.


    Updates serve-handler from 6.1.3 to 6.1.5

    Release notes

    Sourced from serve-handler's releases.

    6.1.5

    Patches

    • Fix publish action: #189
    • Ensure npm run prepublish gets executed: #190

    6.1.4

    Patches

    • Bump lodash from 4.17.15 to 4.17.19: #124
    • Bump codecov from 3.7.0 to 3.7.1: #126
    • Bump node-fetch from 2.1.2 to 2.6.1: #131
    • Update minimatch from 3.0.4 to 3.1.2: #180

    Credits

    Huge thanks to @​kachkaev for helping!

    Commits
    Maintainer changes

    This version was pushed to npm by vercel-release-bot, a new releaser for serve-handler since your current version.


    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 1
Releases(v2.3.0)
  • v2.3.0(Dec 14, 2022)

    New Content

    • ✨ #100 : add new lecture on cascading deletes (also on the Udemy course)
    • ✨ #101 : add insomnia export files so students can easily import them rather than having to create them manually for each section

    Updated Content

    • 🐛 #102: fix requirements file in section 6 and remove incorrect imports

    Full Changelog: https://github.com/tecladocode/rest-apis-flask-python/compare/v2.2.0...v2.3.0

    Source code(tar.gz)
    Source code(zip)
  • v2.2.0(Nov 21, 2022)

    New Content

    • ✨ Added Insomnia export files per-section and for all sections, and e-book page to explain how to use them #92, #97

    Updated Content

    Improvements

    • 📊 Add links to Udemy course throughout e-book and some trial videos #89
    • 📊 Use Algolia search, update style of e-book and update Docusaurus version #96

    Bug fixes

    • 🐛 Added missing uuid import and fixed first few projects so code matches course #88
    • 🐛 Fix inconsistencies between video course and GitHub code #90
    • 🐛 Use db.Integer instead of db.String for foreign keys where required #91
    Source code(tar.gz)
    Source code(zip)
  • v2.1.0(Oct 20, 2022)

    New Content

    • Section 12 on using task queues with rq to send emails through Mailgun, #83, #85

    Updated Content

    • Remove before_first_request in Flask apps, since now the recommended approach is to just do any necessary setup inside create_app(), #77
    • Remove db.create_all() from create_app() when using Flask-Migrate, since it is Flask-Migrate that creates the tables, #78
    • Add information to the e-book on how to make sure tag and item have the same store id when linking them, #79
    • Added missing required arguments in Flask-JWT-Extended callbacks, #81
    • Added missing hostname in the command to run Flask using the Flask development server in Docker, #82
    • Use FLASK_DEBUG instead of FLASK_ENV across entire ebook and all projects since FLASK_ENV is now deprecated, #84
    • Remove password's unique=True in all user models, #86
    Source code(tar.gz)
    Source code(zip)
  • v2.0.1(Oct 3, 2022)

    • ✨ Add search bar to e-book so it's easier to find content by heading #69
    • 📝 Add Windows command for mounting Docker volumes #70
    • 🐛 Fix typos where .value() was used instead of .values() in a dictionary method call #68, #75
    Source code(tar.gz)
    Source code(zip)
  • v2.0.0-beta.5(Sep 23, 2022)

    New content

    • ✨ Released section on deployments via Render.com #62

    Bug fixes

    • 🐛 Fixed typo in Docker volumes through #61 (thanks @LUS24 )
    Source code(tar.gz)
    Source code(zip)
  • v2.0.0(Sep 23, 2022)

  • v2.0.0-beta.4(Aug 23, 2022)

    While recording the Flask-JWT-Extended version, made a few improvements.

    New content

    • ✨ Add lecture on how JWTs are used.
    • ✨ Add lecture on Insomnia request chaining.

    Content improvements

    • 👨‍💻 Make item name not unique as it was an unrealistic constraint in a real system.
    • 👨‍💻 Remove @classmethod from User resource endpoint. These were left over from a previous version of the course.
    • 🐛 Improve explanations in "What is a REST API"
    • 🐛 Improve code blocks in SQLAlchemy section.
    Source code(tar.gz)
    Source code(zip)
  • v2.0.0-beta.3(Jul 11, 2022)

    Making a release after doing some code improvements while recording the Flask-Smorest section.

    • ✨ Split one lecture into 3 to make it more readable, via #57
    • Changed plural endpoints such as /items, /stores, and /tags to the singular counterparts, throughout all the sections.
    Source code(tar.gz)
    Source code(zip)
  • v2.0.0-beta.2(Jul 8, 2022)

    Added the Git section, which is really just a link to another e-book that I wrote for a live stream: https://git-workshop.tecladocode.com.

    New content

    • ✨ Add new Git section
    • 🎨 Improve Docker section with diagrams and improved explanations

    note: this release was previously accidentally released on master, but it should've been on develop.

    Source code(tar.gz)
    Source code(zip)
  • v2.0.0-beta.1(Jun 20, 2022)

    First beta release as I'll start recording the course content for publishing on Udemy based on this release.

    Content may still change substantially during recording.

    New content

    • ✨ Added database migrations section via #54
    Source code(tar.gz)
    Source code(zip)
  • v2.0.0-alpha.4(Jun 8, 2022)

  • v2.0.0-alpha.3(Jun 1, 2022)

  • v2.0.0-alpha.2(Jun 1, 2022)

    Add section on SQL database storage using SQLAlchemy and Flask-SQLAlchemy.

    This release includes Item and Store models, and their one-to-many relationship, via #50.

    Source code(tar.gz)
    Source code(zip)
  • v2.0.0-alpha.1(May 27, 2022)

    First release of the v2 of the course 🎉

    We've written a few sections of our upcoming course! These sections are available for free in the course e-book (still a work in progress, but these are the finished sections):

    • #43 Using Docusaurus instead of Vuepress
    • Your First REST API. A guide to getting started with Flask to make a REST API. Added via #44 and #45.
    • An Introduction to Docker for Flask. This section guides you quickly through what Docker is and how to use it. Added via #46.
    • Flask-Smorest for More Efficient Development. Here we talk about a Flask extension for creating REST APIs, similar (but a bit better) to Flask-RESTful (which we use in the current version of the REST APIs with Flask and Python course). Added via #47 and #48.
    Source code(tar.gz)
    Source code(zip)
  • v1.0.1(May 27, 2022)

    • #34
    • #39 and updated PDFs with the updated content
    • Updated README.md file so it's a bit clearer what's going on. Both direct on the master branch (sorry!) and via #49
    Source code(tar.gz)
    Source code(zip)
  • v1.0.0(Jul 2, 2021)

    Although this isn't the first actual release of this course, it's the first official release. That's why we're calling it v1.0.0.

    There have been a few changes since the original course was made (and that possibly differs from what's on Udemy):

    • Guides written for deployments, with #6 , #7, #8, #9, #22, #29, and #30 .
    • Flask-JWT-Extended added (this is the last section on the Udemy course) via #14, #15, #16, and #17
    • Bugs fixed with #1, #2, #3, #4, #5, #13, #19, #20, #23, #25

    Moving forward our plan is to work in public, share our decisions about what we cover and don't cover, and show the changes we make over time.

    We'll make use of GitHub Discussions for the Teclado team to talk about the course. If you have suggestions that haven't been mentioned before, please feel free to add them to the Discussions section, under "Ideas". Please don't use the GitHub Discussions to ask questions about the course (use the Udemy Course Q&A or our Discord server for that!).

    We'll use Issues and Pull Requests (and maybe Projects) to track our work publicly over time.

    Source code(tar.gz)
    Source code(zip)
Owner
Teclado
We teach and build software learning content.
Teclado
A Django api to display items and their current up-to-date prices from different online retailers in one platform.

A Django api to display items and their current up-to-date prices from different online retailers in one platform. Utilizing scrapy to periodically scrape the latest prices from different online reta

Kennedy Ngugi Mwaura 1 Nov 05, 2021
Little Library API REST

Little Library API REST py 3.10 The only one requeriment it's to have Flask installed.

Luis Quiñones Requelme 1 Dec 15, 2021
A JSON Web Token authentication plugin for the Django REST Framework.

Simple JWT Abstract Simple JWT is a JSON Web Token authentication plugin for the Django REST Framework. For full documentation, visit django-rest-fram

Jazzband 3.3k Jan 04, 2023
Dropdown population implementation for Django REST Framework

drf-dropdown Dropdown population implementation for Django REST Framework Usage Add DropdownView to API URL # urls.py import dropdown urlpatterns = [

Preeti Yuankrathok 4 Dec 06, 2022
Scaffold django rest apis like a champion 🚀

scaffold django rest apis like a champion 🚀

Abdenasser Elidrissi 133 Jan 05, 2023
FastAPI framework, high performance, easy to learn, fast to code, ready for production

FastAPI framework, high performance, easy to learn, fast to code, ready for production Documentation: https://fastapi.tiangolo.com Source Code: https:

Sebastián Ramírez 53.1k Jan 06, 2023
Django queries

Djaq Djaq - pronounced “Jack” - provides an instant remote API to your Django models data with a powerful query language. No server-side code beyond t

Paul Wolf 53 Dec 12, 2022
Generate Views, Serializers, and Urls for your Django Rest Framework application

DRF Generators Writing APIs can be boring and repetitive work. Don't write another CRUDdy view in Django Rest Framework. With DRF Generators, one simp

Tobin Brown 332 Dec 17, 2022
Authentication for Django Rest Framework

Dj-Rest-Auth Drop-in API endpoints for handling authentication securely in Django Rest Framework. Works especially well with SPAs (e.g React, Vue, Ang

Michael 1.1k Dec 28, 2022
Integrate GraphQL into your Django project.

Graphene-Django A Django integration for Graphene. 💬 Join the community on Slack Documentation Visit the documentation to get started! Quickstart For

GraphQL Python 4k Dec 31, 2022
Key-Value база данных на Tarantool и REST API к ней.

KVmail Key-Value база данных на Tarantool и REST API к ней. Документация к API доступна здесь. Requiremrnts ubuntu 16.04+ python3.6+ supervisord nginx

1 Jun 16, 2021
Django Ninja is a web framework for building APIs with Django and Python 3.6+ type hints.

💨 Fast, Async-ready, Openapi, type hints based framework for building APIs

Vitaliy Kucheryaviy 3.8k Jan 04, 2023
Embrace the APIs of the future. Hug aims to make developing APIs as simple as possible, but no simpler.

Read Latest Documentation - Browse GitHub Code Repository hug aims to make developing Python driven APIs as simple as possible, but no simpler. As a r

Hug API Framework 6.7k Dec 27, 2022
RESTful Todolist API

RESTful Todolist API GET todolist/ POST todolist/ {"desc" : "Description of task to do"} DELETE todolist/int:id PUT todolist/int:id Requirements D

Gabriel Tavares 5 Dec 20, 2021
BreakFastApi 🍣 🍔 🍕 The most delicious API on the web

BreakFastApi 🍣 🍔 🍕 The most delicious API on the web. Just send a request and you'll receive the most mouth watering dish recipe with estimated coo

Mariia Sizova 156 Nov 19, 2022
A small repository of projects built in my course, REST APIs with Flask and Python.

A small repository of projects built in my course, REST APIs with Flask and Python.

Teclado 1k Jan 05, 2023
Simplified REST API to get stickers from Snap

Snap Sticker kit REST API Simplified REST API to get stickers from Snap 💻 Instructions Search stickers Request: url = "https://sticker-kit-horizon733

Dishant Gandhi 1 Jan 05, 2022
A lightweight REST miniframework for Python.

restless A lightweight REST miniframework for Python. Documentation is at https://restless.readthedocs.io/. Works great with Django, Flask, Pyramid, T

Daniel Lindsley 824 Nov 20, 2022
Estudo e desenvolvimento de uma API REST

Estudo e desenvolvimento de uma API REST 🧑‍💻 Tecnologias Esse projeto utilizará as seguintes tecnologias: Git Python Flask DBeaver Vscode SQLite 🎯

Deusimar 7 May 30, 2022