fixed json reply bug

This commit is contained in:
dtookey 2021-04-20 21:56:11 -04:00
parent 5fd586ead5
commit c590443de3

View File

@ -22,7 +22,7 @@ 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"})
return flask.make_response("{\"message\":\"%s\"}" % message, 200, {"Content-Type": "application/json"})
@api.route('/api/v1/command', methods=['GET'])
@ -37,9 +37,9 @@ def command_check():
@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)
return flask.make_response('{\"text\":"Argument \'command_name\' not in request"}', 400)
if 'rest' not in request.args:
return flask.make_response('{text:"Argument \'rest\' not in request"}', 400)
return flask.make_response('{\"text\":"Argument \'rest\' not in request"}', 400)
return handle_command(request.args['command_name'], request.args['rest'])