All Questions
Tagged with python-asyncio flask
105 questions
0
votes
0
answers
53
views
In discord.py, flask-socketio, and flask, how do I send a file to the server from a listening socket?
I already tried using various methods with async functions and scheduling tasks, and event loops. I don't know what to do. The code below is the socket that recieves the uploaded file and posts it to ...
0
votes
0
answers
28
views
Unable to implement webhook with flask-smorest using async
I am trying to implement a simple mock api that implements webhooks using flask-smorest.
Basically, I am trying to mimic an api that process a video and sends a post response of succesful/error once ...
1
vote
0
answers
170
views
flask return async generator in async endpoint
Flask allows streaming content using generators.
But, I can't stream content using an async generator in an async endpoint. Here's an example:
from flask import Flask, Response
import asyncio
app = ...
0
votes
0
answers
148
views
Stream response in Flask with AsyncGenerator
I would need to stream data to the user via an endpoint through a function that returns an AsyncGenerator
The idea is as follows:
message_route = Blueprint('message_route', __name__, template_folder='...
0
votes
0
answers
27
views
python asyncio.run inside reused method [duplicate]
In Python, whenever I see examples asyncio.run() usage it is inside a main function.
I have this scenario in my Flask application:
A request goes through:
MyController → MyService → MyRepository
I ...
0
votes
0
answers
143
views
got Future <Future pending> attached to a different loop : error while running code
I am trying to build a service which runs on a flask server that creates a schedule and runs it continuously to poll data and check results. I'm using apscheduler and AsyncIOS for this. The issue is ...
0
votes
0
answers
31
views
Using Flask request in Async Functions Across Modules
I'm working on an async Flask application and have a custom object that initializes with request data. Here is a simplified version of my code:
In my route handler:
@app.route('/')
async def ...
0
votes
0
answers
36
views
Websocket stuck in CONNECTING readyState until ERR_CONNECTION_ABORTED error
I have a simple python Flask backend using Asyncio:
# Simplified version of backend
connectedClients = {}
async def handler(webSocket):
async for messageString in webSocket:
print(f'...
1
vote
1
answer
148
views
Flask: how to return validation before full route code execution
Sorry for newbie question - I am new in Python.
I have to return validation result of Flask route parameter before main code execution:
@app.route('/', methods=['POST'])
def index():
validation = ...
0
votes
0
answers
94
views
How can I pass a parameter to Async function in Python
So I am using Python Flask (ik, not optimal, but it is what I know.) However, I am getting an error that I understand, but I am not familiar enough with async to be able to solve it myself. I lack ...
1
vote
1
answer
393
views
run an async websocket loop in background of flask app
I am trying to build an app which will connect to a websocket (for streaming data) and provide this data with rest API. I am using Flask for creating my API and websockets package for connecting to ...
-1
votes
1
answer
72
views
frontend not displaying data emitted from socketio in real-time
my websockets app sends data fom the backend to the frontend. but it only updates whenever i refesh the page ,not real-time . I want the updating to be real time
my websockets app sends data fom the ...
3
votes
2
answers
968
views
"Event loop is closed" in Flask/LangChain/asyncio app
Context. I want to run a few LLM requests in parallel. I'm using Flask, LangChain, and asyncio. Flask is installed with the "async" extra.
Problem. Every second (!) time the app handles a ...
0
votes
0
answers
116
views
Flask with firebase_admin async firestore client runtime error: Event loop is closed
When running a Flask application in combination with an async firestore client, a runtime error 'Event loop is closed' appears the second time loading the page.
Example app:
import firebase_admin
from ...
0
votes
1
answer
87
views
How to launch / terminate periodic task running on the background using python asyncio in Flask Backend App?
I have a python flask backend app. I want to create a mechanism that can let some jobs run periodic on the background, like auto-update something every 1 minute.
But I have been blocked by some errors ...