From b471b814e34e48b1c53828a1f7dcc048c03808a9 Mon Sep 17 00:00:00 2001 From: Amit Moryossef Date: Tue, 2 Jul 2024 18:31:00 +0200 Subject: [PATCH] fix(server): use make_response explicitly --- signwriting/fingerspelling/server.py | 6 ++++-- signwriting/mouthing/server.py | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/signwriting/fingerspelling/server.py b/signwriting/fingerspelling/server.py index e385ec7..8528161 100644 --- a/signwriting/fingerspelling/server.py +++ b/signwriting/fingerspelling/server.py @@ -1,3 +1,4 @@ +from flask import make_response, jsonify from flask_restful import Resource, reqparse from signwriting.fingerspelling.fingerspelling import spell, get_chars_by @@ -14,6 +15,7 @@ def get(self): try: chars = get_chars_by(value=args["signed_language"], category="SIGNED") except ValueError as e: - return {"message": str(e)}, 400 + return make_response(jsonify({"message": str(e)}), 400) - return {"fsw": spell(args["text"], chars=chars)} + fsw = spell(args["text"], chars=chars) + return make_response(jsonify({"fsw": fsw}), 200) diff --git a/signwriting/mouthing/server.py b/signwriting/mouthing/server.py index 7b779d6..5eeac74 100644 --- a/signwriting/mouthing/server.py +++ b/signwriting/mouthing/server.py @@ -1,3 +1,4 @@ +from flask import make_response, jsonify from flask_restful import Resource, reqparse from signwriting.mouthing.mouthing import mouth @@ -12,4 +13,5 @@ class Mouthing(Resource): def get(self): args = parser.parse_args() - return {"fsw": mouth(args["text"], language=args["spoken_language"])} + fsw = mouth(args["text"], language=args["spoken_language"]) + return make_response(jsonify({"fsw": fsw}), 200)