aboutsummaryrefslogtreecommitdiff
path: root/gn3
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2022-03-04 08:31:42 +0300
committerFrederick Muriuki Muriithi2022-03-04 08:31:42 +0300
commit84f51f48a59da93e287d793d983ace4d06ccb483 (patch)
tree5a95822d27d18a89d39e3fc50efaeff4a9ac792c /gn3
parentf7febf20803f6221eac7b4987cfdfccf50c7e3d7 (diff)
downloadgenenetwork3-84f51f48a59da93e287d793d983ace4d06ccb483.tar.gz
Automatically decode Redis strings
Diffstat (limited to 'gn3')
-rw-r--r--gn3/api/async_commands.py7
1 files changed, 2 insertions, 5 deletions
diff --git a/gn3/api/async_commands.py b/gn3/api/async_commands.py
index f8400c8..81c3c44 100644
--- a/gn3/api/async_commands.py
+++ b/gn3/api/async_commands.py
@@ -8,14 +8,11 @@ async_commands = Blueprint("async_commands", __name__)
@async_commands.route("/state/<command_id>")
def command_state(command_id):
- with redis.Redis() as rconn:
+ 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.decode("utf-8"): val.decode("utf8")
- for key,val in state.items()
- }
+ state = {key: val for key,val in state.items()}
return jsonify(state)