fixed json reply bug
This commit is contained in:
parent
5fd586ead5
commit
c590443de3
@ -22,7 +22,7 @@ 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'])
|
||||||
@ -37,9 +37,9 @@ def command_check():
|
|||||||
@api.route('/api/v1/exec', methods=['GET'])
|
@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)
|
||||||
if 'rest' not in request.args:
|
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'])
|
return handle_command(request.args['command_name'], request.args['rest'])
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user