Category "fastapi"

How to run FastAPI server as multiple instances

I have developed a FastAPI Web Application. If I run the server and it is down or crashed for some reason. I need multiple instances of server to be running. I

iOS - Failed to upload video file from swift to FastAPI server

I took the code for uploading the video file from this question, however, an error occurs. This is the code to select a video from an album: var videoURL: URL?

Getting "Failed to establish a new connection: [Errno -3] Temporary failure in name resolution" in Uvicorn server in Docker environment

I am getting the below exception while making a call from my project- My code is deployed on Docker and inside it running python uvicorn server. I have double c

FastAPI: How to use POST data as variable to trigger another script?

I have written an API on FastAPI with filename api.py: from fastapi import FastAPI from pydantic import BaseModel app = FastAPI() class Username(BaseMode

get_current_user doesn't work (OAuth2PasswordBearer problems)

This is actually the first time it doesn't work, I mean I've practiced this before, but now I have no idea what's wrong. So I am trying to implement basic func

Define a Request parameter as an optional variable type in fastapi

I would like to define a Request object as an optional variable type in FastAPI, but I got an error: fastapi.exceptions.FastAPIError: Invalid args for response

FastAPI swagger don't use custom header

I want to add "Authorization" header to the my FastAPI application. I did it by documentation, but when i try to execute request in the swagger - it doesn't wor

Intermittent CORS issue with FastAPI deployed on Heroku

I deployed a FastAPI based backend on Heroku and whenever I query the url via cURL or Postman, it works fine. However, when it queried from a chrome extension (

FastApi pydantic: Json object inside a json object validation error

There is a nested rule of class DocumentSchema in pydantic written in FastApi as follows: class DocumentSchema(BaseModel): clientName: str transactionId

Is there any way we can integrate terraform with fastapi?

Is there a way to call terraform deployment utility in service endpoint(fastapi, flask) To summarize Integration of service endpoint with Terraform?

starting container process caused: exec: "uvicorn": executable file not found in $PATH: unknown

I'm trying to Dockerize my FastApi app, but it crash with this error right after I run the command, docker-compose -f local.yml up -d. Some one can help me plea

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