Answer the question
In order to leave comments, you need to log in
How in Flask on Pyhon 3 using _thread not to delay the http response while processing is in progress?
All the best! I’m studying python a little, but it’s a bit difficult with streams .... until I figured it out to the end :(
I have a simple http server on Flask , a POST request comes to it, python processes it, but for a long time, respectively, the client waits a long time for an answer, and cannot resend a new request until it receives this response, and the response itself is not important ...
Tried something like this:
def append_to_sheet(first, second):
row = [datetime.now(), first, second]
sheet.append_row(row)
@app.route("/action" , methods=['POST'])
def cardAction():
first_param: request.args.get('first'),
second_param: request.args.get('second')
while True:
_thread.start_new_thread(append_to_sheet, (first_param, second_param))
return "ok!"
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question