From f953ac8c621812f9bcac179c1f80c7597d8381dd Mon Sep 17 00:00:00 2001 From: waltem01 Date: Thu, 23 Nov 2023 10:07:41 +0100 Subject: [PATCH] text and update endpoint --- API/main.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/API/main.py b/API/main.py index 0b4814c..66a2078 100644 --- a/API/main.py +++ b/API/main.py @@ -9,6 +9,34 @@ import time, threading api = Flask(__name__) +@api.route('/text', methods=['POST']) +def display_text(): + response = { 'success': True } + try: + global matrix + + data = request.get_json() + text = data.get('text') + x_coord = data.get('x') + y_coord = data.get('y') + + matrix.text(x_coord, y_coord, text) + except: + response['success'] = False + + return jsonify(response) + +@api.route('/update', methods=['GET']) +def update_matrix(): + response = { 'success': True } + + try: + global matrix + matrix.update() + except: + response['success'] = False + + return jsonify(response) class Matrix(SampleBase):