FastAPI

FastAPI: How to Change the Response Status Code

Updated: September 2, 2023 By: Khue

FastAPI, as its name implies, is a fast, modern, and high-performance web framework for building backend APIs with Python. The response status code is a three-digit number that…

How to Model Reponses in FastAPI (3 Examples)

Updated: September 2, 2023 By: Khue

The Fundamentals FastAPI is a fast-growing Python web framework that can help you build high-performance backend projects. One of the features of the web framework is that it…

FastAPI: How to Create a Custom 404 (Not Found) Route

Updated: August 30, 2023 By: Khue

404 is an HTTP status code that indicates that a server couldn’t find the resource requested by a client (such as a web browser or API client). FastAPI…

FastAPI AttributeError: ‘dict’ object has no attribute ‘encode’

Updated: August 9, 2023 By: Khue

This concise, straight-to-the-point article will walk you through a couple of different solutions to fix a common error you might encounter when working with FastAPI. The Problem Here…

2 Ways to Implement Pagination in FastAPI

Updated: May 18, 2023 By: Khue

Introduction Pagination is a process of dividing a large amount of data into smaller chunks. It is important because it can improve the performance, usability, and security of…

FastAPI: Render HTML Templates with Dynamic Content

Updated: May 16, 2023 By: Goodman

Overview FastAPI is often used to develop backend APIs. However, you can also use this web framework to render HTML templates and create websites with the help of…

FastAPI: How to Return a TXT or JSON File

Updated: May 16, 2023 By: Goodman

This concise, practical article shows you how to return a TXT or a JSON file in FastAPI. I assume you already have some understanding of the web framework,…

FastAPI: How to extract request headers (2 approaches)

Updated: April 18, 2023 By: Goodman

This concise, practical article will walk you through a couple of different ways to extract headers from an incoming request in FastAPI. What are HTTP headers? Headers are…

3 Ways to Get User’s IP Address in FastAPI

Updated: April 24, 2023 By: Khue

When building backend applications with FastAPI, you may need to get the IP addresses of your users for several purposes, such as: This quick article shows you a…

How to Return a CSV File in FastAPI

Updated: March 19, 2023 By: Khue

CSV stands for Comma Separated Values. It is a plain text file that stores data by delimiting data entries with commas. CSV files are popular in Python apps…

1 2 3 4