Creating a websocket with FastAPI

Creating a websocket with FastAPI

Tiempo de lectura: 2 minutos Today we are going to learn how we can quickly and easily generate a websocket with FastAPI. Step 1: Environment Setup, if you already have FastAPI installed, you can skip these steps. Make sure you have Python installed on your system. Then, install FastAPI and Uvicorn using pip: pip install fastapi uvicorn Step 2: Create … Read more

Encrypt a file and get it decrypted using FAST-API

Encrypt a file and get it decrypted using FAST-API

Tiempo de lectura: 2 minutos Today we are going to learn how to store an encrypted file and how to decrypt it to return it in a response. We will use the Fernet library. pip install cryptography First, let’s create an encryption key with Fernet. def generate_key(): key = Fernet.generate_key() return key.decode(‘utf-8’) With this function, we can obtain a random … Read more

How to Handle Errors and Send Emails in Case of Exceptions in FastAPI

How to Handle Errors and Send Emails in Case of Exceptions in FastAPI

Tiempo de lectura: 2 minutos In FastAPI development with Python, proper error handling is crucial to ensure smooth operation. In this tutorial, we will learn to implement an exception handling system that will automatically send an email to the administrator when an error occurs in our API. Step 1: Setting up the handler.py File Firstly, we will create a file … Read more