diff --git a/API/main.py b/API/main.py index a99426b..1e8d3ea 100755 --- a/API/main.py +++ b/API/main.py @@ -18,6 +18,7 @@ def display_text(): response = { 'success': True } try: global matrix + assert matrix is not None # receive client data data = request.form @@ -43,6 +44,7 @@ def set_pixel(): response = { 'success': True } try: global matrix + assert matrix is not None # receive client data data = request.form @@ -67,6 +69,7 @@ def draw_circle(): response = { 'success': True } try: global matrix + assert matrix is not None # receive client data data = request.form @@ -92,6 +95,7 @@ def draw_rectangle(): response = { 'success': True } try: global matrix + assert matrix is not None # receive client data data = request.form @@ -119,6 +123,7 @@ def set_color(): response = { 'success': True } try: global matrix + assert matrix is not None # receive client data data = request.form @@ -144,6 +149,7 @@ def clear_canvas(): response = { 'success': True } try: global matrix + assert matrix is not None # clear matrix canvas matrix.clear() @@ -152,6 +158,7 @@ def clear_canvas(): print(e) response['success'] = False + # respond to client return jsonify(response) @api.route('/update', methods=['GET']) @@ -160,6 +167,7 @@ def update_matrix(): response = { 'success': True } try: global matrix + assert matrix is not None # swap matrix canvas matrix.update()