aboutsummaryrefslogtreecommitdiff
path: root/gn3/api/async_commands.py
diff options
context:
space:
mode:
Diffstat (limited to 'gn3/api/async_commands.py')
-rw-r--r--gn3/api/async_commands.py6
1 files changed, 2 insertions, 4 deletions
diff --git a/gn3/api/async_commands.py b/gn3/api/async_commands.py
index 81c3c44..c0cf4bb 100644
--- a/gn3/api/async_commands.py
+++ b/gn3/api/async_commands.py
@@ -1,6 +1,4 @@
"""Endpoints and functions concerning commands run in external processes."""
-import json
-
import redis
from flask import jsonify, Blueprint
@@ -8,11 +6,11 @@ async_commands = Blueprint("async_commands", __name__)
@async_commands.route("/state/<command_id>")
def command_state(command_id):
+ """Respond with the current state of command identified by `command_id`."""
with redis.Redis(decode_responses=True) as rconn:
state = rconn.hgetall(name=command_id)
if not state:
return jsonify(
status=404,
error="The command id provided does not exist.")
- state = {key: val for key,val in state.items()}
- return jsonify(state)
+ return jsonify(dict(state.items()))