Category "fastapi"

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,

Can I create a Teams bot without using Bot Framework?

I want to create MS Teams chat-bot without using MS Bot Framework. However, in the official document, there was only an example of using the MS Bot Framework. I

fastapi + aiomysql connection pool stuck after 10 calls

Why aiomysql connection pool stuck after N calls? (N is the maxsize number of connection. Tried the default N=10 and N=3) I thought the acquired connections are

FastAPI UploadFile is slow compared to Flask

If I create an endpoint like below: @app.post("/report/upload") def create_upload_files(files: UploadFile = File(...)): try: with open(files

Best way to override FastAPI dependencies for testing with a different dependency for each test

According to FastAPI official documentation the recommended way to override the dependencies for testing is to do it globally before all tests are run: asy

How to send a base64 encoded image to a FastAPI backend

I'm using code from this and that answer to send a base64 encoded image to a python FastAPI backend. The client side looks like this: function toDataURL(src, ca

How write logs to file with unicorn config

Its my uvicorn log_config.yaml. All works perfect untill i add logging to file. Its says to me ValueError: not enough values to unpack (expected 5, got 0) I tr