Category "fastapi"

FastAPI error: Cannot import name 'FastApi' from 'fastapi'

I want to use FastAPI. I installed it using pip, and when I am adding it to my project like that: from fastapi import FastApi and running it, Iam getting the

using slowapi with a datamodel instead of request as parameter

I want to use slowapi on a fastapi python app, for implementing RateLimiter. However, The definitions of the endpoints use a data model for parameters (inheriti

How do I save a FastAPI UploadFile which is a zip file to disk as .zip?

I'm uploading zip files as UploadFile via FastAPI and want to save them to the filesystem using async aiofiles like so: async def upload(in_file: UploadFile = F

uploading multiple files UploadFiles FastAPI

Example Here's my code: from typing import List from fastapi import FastAPI, File, UploadFile import asyncio import concurrent.futures app = FastAPI() @app.po

How to document default None/null in OpenAPI/Swagger using FastAPI?

Using a ORM, I want to do a POST request letting some fields with a null value, which will be translated in the database for the default value specified there.

How do I send list of dictionary as Body parameter in FastAPI?

In FastAPI to pass a list of dictionary, generally we will define a pydantic schema and will mention as: param: List[schema_model] The issue I am facing is tha

Python: FastAPI 422 Unprocessable Entity error

When I use GET request to send data to the server it works fine, but when use POST request it throws "422 Unprocessable Entity" error. This is my Ajax request c

python: A problem of image i/o based on fastapi

I try to make a code for image style transfer based on fastapi. I made the code by referring to many articles in Github and stack overflow, I found it effective

Python - How to use FastAPI and uvicorn.run without blocking the thread?

I'm looking for a possibility to use uvicorn.run() with a FastAPI app but without uvicorn.run() is blocking the thread. I already tried to use processes, subpro

Fast API Python special log parameter for each request

Maybe someone here have a good idea on how to solve my issue. I have a REST API project driven by FastAPI. Every incomming request comes with a hash in the head

FastAPI throws an error (Error loading ASGI app. Could not import module "api")

I tried to run FastAPI using uvicorn webserver but it throws an error. I run this command, uvicorn api:app --reload --host 0.0.0.0 but there is an error in the

FastAPI throws an error (Error loading ASGI app. Could not import module "api")

I tried to run FastAPI using uvicorn webserver but it throws an error. I run this command, uvicorn api:app --reload --host 0.0.0.0 but there is an error in the

FastApi create background task in a custom APIRoute

According to this tutorial you can create BackgroundTasks from the route function as follow: @app.post("/send-notification/{email}") async def send_notification

How to get current active user in middleware FastAPI python

I have developed an auth on FastAPI Python using the doc here https://fastapi.tiangolo.com/tutorial/security/oauth2-jwt/ (I use exactly the code shown, nothing

How do I return a dict + an image from a FastAPI endpoint?

I am trying to use FastAPI to allow my (dockerized) server to respond to API calls returning an image image, and a dictionary additional_dict (for a machine lea

How to run UVICORN in Heroku?

So I have figured out how to code a fastAPI and I am ready to deploy my script to heroku that I have worked with fastAPI (https://fastapi.tiangolo.com/) however

FastAPI websockets not working when using Redis pubsub functionality

currently I'm using websockets to pass through data that I receive from a Redis queue (pub/sub). But for some reason the websocket doesn't send messages when us

FastAPI cannot find main.py: `ERROR: Error loading ASGI app. Could not import module "main"

I know usually it is something about project structure that raises this error. But my project structure is the simplest one: . ├── blog.db

Is there a way to exclude Pydantic models from FastAPI's auto-generated documentation?

Is there a way for a FastAPI application to not display a model in its schema documentation? I have some models which are slight variations of others, and with

Meraki API - Redirect stdout, stderr to websocket or file

I'm using a Flask route to call the Meraky python library and trying to redirect the stdout and stderr of each API call to a websocket or eventually a log file,