From a88841c174149392063c88f8d7a749b677990362 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Thuret?= Date: Sat, 26 Mar 2022 09:02:54 +0100 Subject: [PATCH] upgrade-to-flask2 --- app/app.py | 12 ++++++------ requirements.txt | 11 ++++++----- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/app/app.py b/app/app.py index 3979c2e..428de95 100644 --- a/app/app.py +++ b/app/app.py @@ -231,7 +231,7 @@ def create_app(args): version=get_version() ) - @app.route("/javascript-licenses", methods=["GET"]) + @app.get("/javascript-licenses") @limiter.exempt def javascript_licenses(): if args.disable_web_ui: @@ -287,7 +287,7 @@ def create_app(args): response.headers.add("Access-Control-Max-Age", 60 * 60 * 24 * 20) return response - @app.route("/translate", methods=["POST"]) + @app.post("/translate") @access_check def translate(): """ @@ -523,7 +523,7 @@ def create_app(args): except Exception as e: abort(500, description="Cannot translate text: %s" % str(e)) - @app.route("/translate_file", methods=["POST"]) + @app.post("/translate_file") @access_check def translate_file(): """ @@ -656,7 +656,7 @@ def create_app(args): except Exception as e: abort(500, description=e) - @app.route("/download_file/", methods=["GET"]) + @app.get("/download_file/") def download_file(filename: str): """ Download a translated file @@ -683,7 +683,7 @@ def create_app(args): return send_file(return_data, as_attachment=True, attachment_filename=download_filename) - @app.route("/detect", methods=["POST"]) + @app.post("/detect") @access_check def detect(): """ @@ -856,7 +856,7 @@ def create_app(args): } ) - @app.route("/suggest", methods=["POST"]) + @app.post("/suggest") @access_check def suggest(): """ diff --git a/requirements.txt b/requirements.txt index e70fded..98feb8c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,16 +1,17 @@ argostranslate==1.6.1 -Flask==1.1.2 +Flask==2.0.3 flask-swagger==0.2.14 flask-swagger-ui==3.36.0 -Flask-Limiter==1.4 -waitress==1.4.4 +Flask-Limiter==2.2.0 +waitress==2.1.1 expiringdict==1.2.1 pyicu>=2.8 pycld2==0.41 morfessor==2.0.6 polyglot==16.7.4 appdirs==1.4.4 -APScheduler==3.7.0 +APScheduler==3.9.1 translatehtml==1.5.2 argos-translate-files==1.0.5 -itsdangerous==2.0.1 +itsdangerous==2.1.2 +Werkzeug==2.0.3