Flask download multiprocess video

Asked

Viewed 15 times

0

I’m doing a project to download videos from a website and store them in a folder on the computer. Here’s the thing, I got a route @app.route('/baixar', methods=['POST']) who is responsible for downloading video and redirecting the user.

Only I wish the user didn’t wait until the video downloaded to be redirected. Is there a way to download under the table?

The code:

@app.route('/baixar', methods=['POST'])
def baixar():
    nome_video = request.args.get('nome_video')
    id_video = request.args.get('id_video')
    
    url_video = "url aqui"
    
    download_file(url_video, nome_video),

    return redirect(url_for('index'))

I want you to download it without crashing the flask

  • 1

    Use the asyncrono feature of Python itself or use Celery.

  • @Guilhermelima can recommend me articles on ansicronia in python? I’ve read about Celery I just think it’s a lot for something so simple.

  • 1

    https://docs.python.org/3/library/asyncio-task.html

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.