Giter Club home page Giter Club logo

wpcodevo / python_fastapi Goto Github PK

View Code? Open in Web Editor NEW
65.0 2.0 23.0 37 KB

This article will teach you how to create a CRUD RESTful API with Python, FastAPI, SQLAlchemy ORM, Pydantic, Alembic, PostgreSQL, and Docker-compose to perform the basic Create/Read/Update/Delete operations against a database.

Home Page: https://codevoweb.com/crud-restful-api-server-with-python-fastapi-and-postgresql

Shell 3.58% Makefile 0.73% Python 72.37% Mako 1.33% HTML 21.98%
fastapi fastapi-crud fastapi-sqlalchemy postgresql pydantic pydantic-models python rest-api restful restful-api

python_fastapi's Introduction

RESTful API with Python, FastAPI, Pydantic, SQLAlchemy and Docker

1. RESTful API with Python,SQLAlchemy, & FastAPI: Access and Refresh Tokens

In this article, you'll learn how to secure a FastAPI app by implementing access and refresh token functionalities using JSON Web Tokens (JWTs). We'll use the FastAPI JWT Auth package to sign, encode and decode the access and refresh JWT tokens.

RESTful API with Python,SQLAlchemy, & FastAPI: Access and Refresh Tokens

Topics Covered

  • Python FastAPI JWT Authentication Overview
  • How to Setup FastAPI with PostgreSQL
    • Setup FastAPI
    • Initialize a Simple FastAPI Server
  • Setting up Environment Variables in FastAPI
  • Connect to the PostgreSQL Docker Container
  • Installing the UUID OSSP PostgreSQL Extension
  • Create Database Models with SQLAlchemy in FastAPI
  • Creating Schemas with Pydantic in FastAPI
  • Password Management with Bcrypt
  • Configure the FastAPI JWT Auth Extension
  • Creating the Authentication Controllers
    • User Registration Controller
    • User Sign-in Controller
    • Refresh Access Token Controller
    • Logout User Controller
  • How to add Protected Routes
  • Create a User Controller
  • Adding the Routes to FastAPI Middleware Pipeline
  • Database Migration with Alembic
  • Testing the FastAPI JSON Web Token API

Read the entire article here: https://codevoweb.com/restful-api-with-python-fastapi-access-and-refresh-tokens

2. RESTful API with Python, SQLAlchemy, & FastAPI: Send HTML Emails

In this article, you'll learn how to send HTML emails with Python, FastAPI, SQLAlchemy, PostgreSQL, Jinja2, and Docker-compose. Also, you'll learn how to dynamically generate HTML templates with the Jinja2 package.

RESTful API with Python, SQLAlchemy, & FastAPI: Send HTML Emails

Topics Covered

  • Send HTML Email with jinja2 and FastAPI Overview
  • Creating an SMTP Provider Account
  • Validating the Environment Variables with Pydantic
  • Create a Database Model with Sqlalchemy
  • Creating the HTML Email Templates with Jinja2
  • Set up SMTP Email Sender
  • How to Send the HTML Email
  • Update the SignUp Path Operation Function
  • Create a Controller to Verify the Code

Read the entire article here: https://codevoweb.com/restful-api-with-python-fastapi-send-html-emails

3. CRUD RESTful API Server with Python, SQLAlchemy, FastAPI, and PostgreSQL

This article will teach you how to create a CRUD RESTful API with Python, FastAPI, SQLAlchemy ORM, Pydantic, Alembic, PostgreSQL, and Docker-compose to perform the basic Create/Read/Update/Delete operations against a database.

CRUD RESTful API Server with Python, SQLAlchemy, FastAPI, and PostgreSQL

Topics Covered

  • Python, FastAPI, PostgreSQL, SQLAlchemy CRUD API Overview
  • Setting up FastAPI and PostgreSQL
    • Building the FastAPI Server
    • Starting the FastAPI Server
  • Setting up Environment Variables in FastAPI
  • Connecting to the PostgreSQL Server
  • Installing the UUID OSSP PostgreSQL Plugin
  • How to Create Database Models with SQLAlchemy
  • Creating Validation Schemas with Pydantic
  • Creating the FastAPI Route Handlers
    • Fetch All Posts Handler
    • Create New Post Handler
    • Update Post Handler
    • Get a Single Post Handler
    • Remove Post Handler
  • Add the Routes to the FastAPI Middleware Stack

Read the entire article here: https://codevoweb.com/crud-restful-api-server-with-python-fastapi-and-postgresql

python_fastapi's People

Contributors

wpcodevo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

python_fastapi's Issues

Pydantic apply_each_item_validators

Hi, trying to launch the project through uvicorn app.main:app --host localhost --port 8000 --reload I receive TypeError: @validator(..., each_item=True) cannot be applied to fields with a schema of json-or-python.
I tried both writing it from scratch and cloning the repo.
Not sure how to debug this, am I the only one who receives this error? The pydantic version is 2.0.3.
Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.