From ac330232ed1194749b52898b217f136623a74ee1 Mon Sep 17 00:00:00 2001 From: Charles Le Maux Date: Thu, 20 Jun 2024 17:52:23 +0100 Subject: [PATCH] [+] Requirements.txt --- api.py | 10 +++++----- requirements.txt | 4 ++++ 2 files changed, 9 insertions(+), 5 deletions(-) create mode 100644 requirements.txt diff --git a/api.py b/api.py index 452dff1..c7bdad0 100644 --- a/api.py +++ b/api.py @@ -1,6 +1,6 @@ from flask import Flask, current_app, make_response, request, jsonify, Response from flask_cors import CORS -from typing import Dict +from typing import Dict, Tuple import generic_executor import json @@ -103,15 +103,15 @@ def update_property() -> Response: return jsonify({'message': 'OK'}), 200 @app.route('/Command', methods=['POST']) -def command() -> Response: +def command() -> tuple[Response, int]: data: Dict[str, str, str] = request.get_json() if not data: return jsonify({"error": "No JSON payload"}), 415 port: str = data.get('port') - command: str = data.get('command') - print(f'Server {port} executed command {command}') - generic_executor.RunCommand(port, command) + _command: str = data.get('command') + print(f'Server {port} executed command {_command}') + generic_executor.RunCommand(port, _command) return jsonify({'message': 'OK'}), 200 diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..13fc6de --- /dev/null +++ b/requirements.txt @@ -0,0 +1,4 @@ +Flask==3.0.3 +Flask_Cors==4.0.1 +plotly==5.22.0 +psutil==5.9.8