From 8b017061c092084249210543289aac513a3b9252 Mon Sep 17 00:00:00 2001 From: dtookey Date: Tue, 20 Apr 2021 21:48:43 -0400 Subject: [PATCH] maybe fixed the issue with the wrong annotation --- standalone_command.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/standalone_command.py b/standalone_command.py index 264902e..edbe488 100644 --- a/standalone_command.py +++ b/standalone_command.py @@ -1,30 +1,30 @@ import flask from flask import request - api = flask.Flask(__name__) -#enable/disable this to get web pages of crashes returned +# enable/disable this to get web pages of crashes returned api.config["DEBUG"] = True + def init(): - #todo load entire command library and cache it here + # todo load entire command library and cache it here pass -def is_command(command:str)->bool: +def is_command(command: str) -> bool: if command == "!echo": return True else: return False -@api.route('/api/v1/exec', methods=['GET']) def handle_command(command, rest): if command == "!echo": message = "Got payload [%s]" % rest print(message) return flask.make_response("{message:\"%s\"}" % message, 200, {"Content-Type": "application/json"}) + @api.route('/api/v1/command', methods=['GET']) def command_check(): if 'name' in request.args: @@ -33,6 +33,8 @@ def command_check(): else: return flask.make_response('', 404) + +@api.route('/api/v1/exec', methods=['GET']) def exec_command(): if 'command_name' not in request.args: return flask.make_response('{text:"Argument \'command_name\' not in request"}', 400)