maybe fixed the issue with the wrong annotation
This commit is contained in:
parent
9a9174f687
commit
8b017061c0
@ -1,11 +1,11 @@
|
|||||||
import flask
|
import flask
|
||||||
from flask import request
|
from flask import request
|
||||||
|
|
||||||
|
|
||||||
api = flask.Flask(__name__)
|
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
|
api.config["DEBUG"] = True
|
||||||
|
|
||||||
|
|
||||||
def init():
|
def init():
|
||||||
# todo load entire command library and cache it here
|
# todo load entire command library and cache it here
|
||||||
pass
|
pass
|
||||||
@ -18,13 +18,13 @@ def is_command(command:str)->bool:
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
@api.route('/api/v1/exec', methods=['GET'])
|
|
||||||
def handle_command(command, rest):
|
def handle_command(command, rest):
|
||||||
if command == "!echo":
|
if command == "!echo":
|
||||||
message = "Got payload [%s]" % rest
|
message = "Got payload [%s]" % rest
|
||||||
print(message)
|
print(message)
|
||||||
return flask.make_response("{message:\"%s\"}" % message, 200, {"Content-Type": "application/json"})
|
return flask.make_response("{message:\"%s\"}" % message, 200, {"Content-Type": "application/json"})
|
||||||
|
|
||||||
|
|
||||||
@api.route('/api/v1/command', methods=['GET'])
|
@api.route('/api/v1/command', methods=['GET'])
|
||||||
def command_check():
|
def command_check():
|
||||||
if 'name' in request.args:
|
if 'name' in request.args:
|
||||||
@ -33,6 +33,8 @@ def command_check():
|
|||||||
else:
|
else:
|
||||||
return flask.make_response('', 404)
|
return flask.make_response('', 404)
|
||||||
|
|
||||||
|
|
||||||
|
@api.route('/api/v1/exec', methods=['GET'])
|
||||||
def exec_command():
|
def exec_command():
|
||||||
if 'command_name' not in request.args:
|
if 'command_name' not in request.args:
|
||||||
return flask.make_response('{text:"Argument \'command_name\' not in request"}', 400)
|
return flask.make_response('{text:"Argument \'command_name\' not in request"}', 400)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user