diff options
author | Frederick Muriuki Muriithi | 2022-03-04 08:31:42 +0300 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2022-03-04 08:31:42 +0300 |
commit | 84f51f48a59da93e287d793d983ace4d06ccb483 (patch) | |
tree | 5a95822d27d18a89d39e3fc50efaeff4a9ac792c | |
parent | f7febf20803f6221eac7b4987cfdfccf50c7e3d7 (diff) | |
download | genenetwork3-84f51f48a59da93e287d793d983ace4d06ccb483.tar.gz |
Automatically decode Redis strings
-rw-r--r-- | gn3/api/async_commands.py | 7 |
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) |