FastAPI

Fixing FastAPI Error: Origin Blocked by CORS Policy

Updated: January 2, 2024 By: Guest Contributor

Overview Cross-Origin Resource Sharing (CORS) is a security measure implemented by web browsers to prevent scripts on a webpage from making requests to a different domain than the…

Troubleshooting FastAPI Unprocessable Entity Error: Solutions and Fixes

Updated: January 2, 2024 By: Guest Contributor

FastAPI Unprocessable Entity Error is a common roadblock for developers building applications with FastAPI. This error, often a ‘422 Unprocessable Entity’ response, indicates that the server understands the…

Solving FastAPI Issue: 405 Method Not Allowed

Updated: January 2, 2024 By: Guest Contributor

The 405 Method Not Allowed error in FastAPI occurs when a client makes a request to the server using a HTTP method not supported by the endpoint. This…

FastAPI StreamingResponse AttributeError Fix

Updated: January 2, 2024 By: Guest Contributor

The Problem When working with FastAPI, it’s common for developers to stream data to clients. However, you might encounter an error like ‘NoneType’ object has no attribute ‘encode’…

Handling FastAPI HTTPValidationError: Fixes and Solutions

Updated: January 2, 2024 By: Guest Contributor

Understanding HTTPValidationError in FastAPI When working with FastAPI, an HTTPValidationError typically occurs when the data sent by a client does not conform to the expected schema defined within…

Handling FastAPI ValidationError: Strategies and Solutions

Updated: January 2, 2024 By: Guest Contributor

Encountering a ValidationError when developing with FastAPI is not uncommon. This error usually indicates that the client has sent invalid data that does not conform to the schema…

How to Run Background Tasks in FastAPI (2 Ways)

Updated: September 3, 2023 By: Khue

In a FastAPI web application, you can do some work in the background without blocking the main thread or the response to the client. This is useful for…

How to Implement Redirects in FastAPI (2 Ways)

Updated: September 3, 2023 By: Khue

Redirect means sending users from one URL to another, usually after performing some action or checking some condition (such as authentication, payment, etc.). This concise, example-based article will…

How to Return PDF Files in FastAPI (3 Examples)

Updated: September 2, 2023 By: Khue

This succinct, straight-to-the-point article will walk you through a couple of different ways to return PDF files in FastAPI. In the upcoming examples, we’ll use this sample PDF…

How to Run FastAPI on a Custom Port

Updated: September 2, 2023 By: Khue

To run a FastAPI application on a custom port, you need to specify the port number when you start your application. The port number is an integer between…

1 2 3 4