forked from mirrors/LibreTranslate
upgrade-to-flask2
This commit is contained in:
parent
6b2ef99f78
commit
a88841c174
2 changed files with 12 additions and 11 deletions
12
app/app.py
12
app/app.py
|
@ -231,7 +231,7 @@ def create_app(args):
|
||||||
version=get_version()
|
version=get_version()
|
||||||
)
|
)
|
||||||
|
|
||||||
@app.route("/javascript-licenses", methods=["GET"])
|
@app.get("/javascript-licenses")
|
||||||
@limiter.exempt
|
@limiter.exempt
|
||||||
def javascript_licenses():
|
def javascript_licenses():
|
||||||
if args.disable_web_ui:
|
if args.disable_web_ui:
|
||||||
|
@ -287,7 +287,7 @@ def create_app(args):
|
||||||
response.headers.add("Access-Control-Max-Age", 60 * 60 * 24 * 20)
|
response.headers.add("Access-Control-Max-Age", 60 * 60 * 24 * 20)
|
||||||
return response
|
return response
|
||||||
|
|
||||||
@app.route("/translate", methods=["POST"])
|
@app.post("/translate")
|
||||||
@access_check
|
@access_check
|
||||||
def translate():
|
def translate():
|
||||||
"""
|
"""
|
||||||
|
@ -523,7 +523,7 @@ def create_app(args):
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
abort(500, description="Cannot translate text: %s" % str(e))
|
abort(500, description="Cannot translate text: %s" % str(e))
|
||||||
|
|
||||||
@app.route("/translate_file", methods=["POST"])
|
@app.post("/translate_file")
|
||||||
@access_check
|
@access_check
|
||||||
def translate_file():
|
def translate_file():
|
||||||
"""
|
"""
|
||||||
|
@ -656,7 +656,7 @@ def create_app(args):
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
abort(500, description=e)
|
abort(500, description=e)
|
||||||
|
|
||||||
@app.route("/download_file/<string:filename>", methods=["GET"])
|
@app.get("/download_file/<string:filename>")
|
||||||
def download_file(filename: str):
|
def download_file(filename: str):
|
||||||
"""
|
"""
|
||||||
Download a translated file
|
Download a translated file
|
||||||
|
@ -683,7 +683,7 @@ def create_app(args):
|
||||||
|
|
||||||
return send_file(return_data, as_attachment=True, attachment_filename=download_filename)
|
return send_file(return_data, as_attachment=True, attachment_filename=download_filename)
|
||||||
|
|
||||||
@app.route("/detect", methods=["POST"])
|
@app.post("/detect")
|
||||||
@access_check
|
@access_check
|
||||||
def detect():
|
def detect():
|
||||||
"""
|
"""
|
||||||
|
@ -856,7 +856,7 @@ def create_app(args):
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
@app.route("/suggest", methods=["POST"])
|
@app.post("/suggest")
|
||||||
@access_check
|
@access_check
|
||||||
def suggest():
|
def suggest():
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -1,16 +1,17 @@
|
||||||
argostranslate==1.6.1
|
argostranslate==1.6.1
|
||||||
Flask==1.1.2
|
Flask==2.0.3
|
||||||
flask-swagger==0.2.14
|
flask-swagger==0.2.14
|
||||||
flask-swagger-ui==3.36.0
|
flask-swagger-ui==3.36.0
|
||||||
Flask-Limiter==1.4
|
Flask-Limiter==2.2.0
|
||||||
waitress==1.4.4
|
waitress==2.1.1
|
||||||
expiringdict==1.2.1
|
expiringdict==1.2.1
|
||||||
pyicu>=2.8
|
pyicu>=2.8
|
||||||
pycld2==0.41
|
pycld2==0.41
|
||||||
morfessor==2.0.6
|
morfessor==2.0.6
|
||||||
polyglot==16.7.4
|
polyglot==16.7.4
|
||||||
appdirs==1.4.4
|
appdirs==1.4.4
|
||||||
APScheduler==3.7.0
|
APScheduler==3.9.1
|
||||||
translatehtml==1.5.2
|
translatehtml==1.5.2
|
||||||
argos-translate-files==1.0.5
|
argos-translate-files==1.0.5
|
||||||
itsdangerous==2.0.1
|
itsdangerous==2.1.2
|
||||||
|
Werkzeug==2.0.3
|
||||||
|
|
Loading…
Reference in a new issue