mirror of
https://gitlab1.ptb.de/waltem01/Matrix
synced 2024-12-25 03:31:44 +00:00
text and update endpoint
This commit is contained in:
parent
36e6f95944
commit
f953ac8c62
28
API/main.py
28
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):
|
||||
|
Loading…
Reference in New Issue
Block a user