text and update endpoint

This commit is contained in:
waltem01 2023-11-23 10:07:41 +01:00
parent 36e6f95944
commit f953ac8c62

View File

@ -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):