Category "fastapi"

AttributeError: 'Depends' object has no attribute 'query' FastAPI

So I am trying to write simple function here, but everytime I run swagger I got above mentioned error. Here's my function: def authenticate_user(username: str,

FastAPI psycopg2 error when creating database for tests

I'm trying to test my database in my FastAPI app. from fastapi.testclient import TestClient from sqlalchemy import create_engine from sqlalchemy.orm import sess

FastAPI route: Adding dynamic path parameters validation

I'm trying to add validation to my route in a fastapi server, followed the instructions here and managed to have added validation on my int path parameters like

How to write a custom FastAPI middleware class

I have read FastAPI's documentation about middlewares (specifically, the middleware tutorial, the CORS middleware section and the advanced middleware guide), bu

Sending Notifications to certain clients using Server Sent Events in FastApi?

I have been working with server sent events to send out certain type of notifications to only certain clients. I am using the module called sse-starlette to try

POST request to FastAPI using Python Requests with a file and query parameters

I am using FastAPI to serve some ML models and I have a Streamlit basic UI using Python Requests module. One of my service is getting an image through a POST re

How to implement pagination for fastapi with mongo db(Motor)

I have a simple REST api which is a books store created with FastAPI and mongo db as the backend (I have used Motor as the library instead of Pymongo). I have a

ASGI callable returned without starting response

The fastAPI that I am working on does not return traceback whenever the request failed, instead, it returns 500 Internal Server Error with error : ERROR: ASG

How do I download a file returned from FastAPI backend using Fetch API at the frontend?

This is my FastAPI(python) code, which returns a .ics file: @app.get("/latLong/") async def read_item(lat: float,long:float): mainFunc(lat,long) return

How to send multiple files with Python requests to FastAPI server?

I have the following endpoint in my FastAPI server: @app.post("/submit") async def submit(file1: List[UploadFile] = File(...), file2: List[UploadFile] = File(..

How to run a uvicorn server (using FastAPI) and a load test (using locust) parallely?

I have two files, both of them runs individually without any error. I used FastAPI to create some endpoints and I am trying to use locust (through a tool invoku

How to get query data converting foreign table's another column

I'm now using sqlalchemy, fastapi develop some REST API. And facing some problem to join multiple tables I have 2 tables as below [campaigns] class Campaign(Bas

How to POST multiple images to FastAPI server using Python requests?

I would like to send multiple images to FastAPI backend using Python requests. Server side from fastapi import FastAPI, UploadFile, File from typing import List

fastapi using ORM not able to convert to pandas

I've been developing a fastapi way to query my database, instead of directly using SQL with pg. For some reason, I'm having issues converting the ORM query retu

FastAPI server returns "422 unprocessable entity" - value_error.missing

from http.client import responses from random import randrange from tkinter.tix import STATUS from typing import Optional from urllib import response from fasta

How to handle extra data error in FastAPI

So I have the following FastAPI code: from fastapi import FastAPI app = FastAPI class Demo(BaseModel): content: str = None @app.post("/demo") async d

How to Pass Authorization Header from Swagger Doc in Python Fast API

I am trying to pass authorization header using Documentation page, similar to this page: Since, the documentations are automatic generated in Fast API, I am ha

How can I POST data in real time using FastAPI?

I built a simple demo project using FastAPI. I would like to POST data to the server in real time (maybe 30fps). # in client while True: .... res = requ

Python websocket with FastAPI does not return data immediately

I created a websocket connection with FastAPI to "stream" data which comes from a tedious calculation. The data chunks should be send as soon as they are availa

FastApi returns "field required" and "value_error.missing" for one of my parameters, but the field is there

I do a Post with some parameters, but one of them returns "field required" and "value_error.missing", but the field is there and it has a value. See the output