Introduction to Python API Building

<p>Python is a powerful programming language with many applications. In this post we will explore its ability to build REST APIs. We will leverage the FastAPI, Pydantic, and SQLAlchemy python libraries, along with Postgres to build a REST API that can support a simple TODO list application. By the end of this tutorial, you will have a working understanding on how to build a Python web application with simple database interactions.</p> <h1>Project Description</h1> <p>For this project we will be implementing a REST API for a todo application. We will provide the ability to create, read, update, and delete, also known as CRUD operations, for the todo items.</p> <h1>Project Setup</h1> <p>If you&rsquo;d like to follow along with this post you will need to have the following tools in your environment.</p> <ul> <li><a href="https://www.python.org/downloads/release/python-380/" rel="noopener ugc nofollow" target="_blank">Python 3.8+</a></li> <li><a href="https://www.docker.com/products/docker-desktop/" rel="noopener ugc nofollow" target="_blank">Docker Desktop</a></li> <li><a href="https://www.jetbrains.com/pycharm/" rel="noopener ugc nofollow" target="_blank">Pycharm</a></li> <li><a href="https://www.jetbrains.com/datagrip/" rel="noopener ugc nofollow" target="_blank">Datagrip</a></li> </ul> <p>We will be using docker to spin up a temporary Postgres instance for our application to connect to. Pycharm and Datagrip are the IDEs that I prefer to use, but you can swap them out for whatever you are comfortable with. All the source code for this project can be found on&nbsp;<a href="https://github.com/wudstrand/todo-api" rel="noopener ugc nofollow" target="_blank">github</a>.</p> <h1>TODO List API</h1> <h1>Database</h1> <p>Before we can build any REST application, it is important that we have the ability to persist our application&rsquo;s data. For this project we will be using a postgres database consisting of one table. But before we get too far ahead of ourselves, let&rsquo;s spin up the database and connect to it!</p> <p><a href="https://medium.com/@will.udstrand/introduction-to-python-api-building-a2e3b80219c">Read More</a></p>
Tags: API Python