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