~metalune/public-inbox

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch

[PATCH] api/translate to POST

Details
Message ID
<PR3P191MB1129C327F7131B239472AC16DF8F9@PR3P191MB1129.EURP191.PROD.OUTLOOK.COM>
DKIM signature
pass
Download raw message
Patch: +6 -4
From: ManeraKai <manerakai@protonmail.com>

---
 main.py | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/main.py b/main.py
index 4ffd85c..f2513ed 100644
--- a/main.py
+++ b/main.py
@@ -68,12 +68,14 @@ async def translate(from_language, to_language, input_text):
    )


@app.route("/api/translate/")
@app.route("/api/translate/", methods=["POST"])
async def api_translate():
    form = await request.form

    engine_name = request.args.get("engine")
    text = request.args.get("text")
    from_language = request.args.get("from")
    to_language = request.args.get("to")
    text = form.get("text")
    from_language = form.get("from")
    to_language = form.get("to")

    engine = get_engine(engine_name, engines, engines[0])

-- 
2.25.1
Reply to thread Export thread (mbox)