Skip to main content

All Questions

1 vote
0 answers
44 views

FastAPI Async Setup [duplicate]

I'm working on a FastAPI application where I need to initialize an async service by loading some large backing data files asynchronously. However, I'm running into issues when using fastapi dev (...
Ivan Webber's user avatar
2 votes
1 answer
60 views

TypeError in FastAPI when using APIRoute with a Router

I have a FastAPI backend and i'm trying to implement an APIRoute class to handle logic before and after the request (logging). # app.py from fastapi import FastAPI, APIRouter from backend.app.routers ...
Yuv_c's user avatar
  • 138
1 vote
1 answer
146 views

FastAPI Global Timeout Middleware Not Working for Sync Routes [duplicate]

I am trying to enforce a global request timeout in my FastAPI application using a custom TimeoutMiddleware. The middleware is supposed to cancel any request that takes longer than the specified ...
Hassan's user avatar
  • 23
0 votes
0 answers
23 views

Playwright exception: no description

I have a strange error with no description when I try to use async playwright This is a FastApi app and I am on Windows In the docs there is a mention that incompatible with SelectorEventLoop of ...
RheinmetallSkorpion's user avatar
1 vote
1 answer
104 views

How to make a non-blocking Websocket endpoint in FastAPI? [duplicate]

I'm fairly new to async in Python. Currently I'm trying to implement a Websocket endpoint with FastAPI that performs a long-running task. The following code is used: @router.websocket("/ws/...
Lev Marder's user avatar
0 votes
0 answers
63 views

Executing command on a pod using asyncio causes exception

I want to execute a long running task on one pod from another. For this I started using subprocess.Popen to accomplish this task which does what I need. However, subprocess.Popen is not asynchronous ...
Positron's user avatar
1 vote
1 answer
381 views

How to upload file in chunks to Google Cloud Storage using FastAPI's request.stream()?

I have a data flow in a FastAPI application where a potentially very large HTTP PUT body is being uploaded, and I need to stream this to Google Cloud Storage. I'm using the gcloud.aio.storage library ...
ChrisC's user avatar
  • 21
1 vote
0 answers
45 views

Do APschedular hold CPU resouces while waiting? [duplicate]

I am working on a webhook handler where I process incoming data and update records in my database. Here's the relevant portion of my code: def handle_rocket_reach_webhook(self, profile_data: any): ...
Arjad Gohar's user avatar
0 votes
2 answers
124 views

Ensure a singleton variable across entire web app

Background Info My web app is built on top of async FastAPI. The server deploying this app will start 4 workers and each worker will start 2 threads for handling concurrent requests. Description Most ...
SteveGu's user avatar
0 votes
1 answer
49 views

Async requests with APIRouter or httpx.AsyncClient [closed]

I'm working on a partially developed FastAPI project. Most client requests in this project use FastAPI's built-in APIRouter with asynchronous functions for client requests, they look like this: from ...
Shifter's user avatar
  • 57
1 vote
1 answer
759 views

How to stop background tasks in a graceful shutdown of FastAPI

Whenever I gracefully shut down my FastAPI app by saving a file (with the --reload option), it waits for all background tasks to be complete before initiating shutdown. uvicorn INFO: Shutting down ...
okay's user avatar
  • 169
0 votes
1 answer
67 views

Stop and resume process by semaphore

I wish to implement an API that utilize asyncio events in order to stop/resume a asyncio task. The API will support the following methods: /import (start) /stop /resume Main problem is happening ...
smdsa1337's user avatar
1 vote
1 answer
411 views

Custom handler for FastAPI to handle to closure of connections

I have a weird issue with FastAPI. The background story is that I have a queue that consist of jobs that get added when I do a request to a FastAPI endpoint. I am using this to test stuff, so I am ...
Jonas's user avatar
  • 65
0 votes
1 answer
521 views

FastAPI with asyncio | Running long running background tasks

I'm running a heavy async task in FastAPI and need to return a response to the user while continuing the task in the background with asyncio. When I await the task, it works perfectly, but when I add ...
Othman Kabbaj's user avatar
0 votes
1 answer
110 views

How to read async stream from non-async method? [duplicate]

I use FastAPI to create the app. One of features is upload of files with PUT request. Fast API supports uploading files with POST requests (multipart form). But I need the PUT request where a file is ...
Roman Gelembjuk's user avatar

15 30 50 per page
1
2 3 4 5
14