From 356da7f042d70b4b7d3808b0900c8bd1cdbac225 Mon Sep 17 00:00:00 2001 From: 2014bduck <2014bduck@gmail.com> Date: Fri, 4 Sep 2020 06:19:43 +0800 Subject: Fixing #1390 modules key in info command (#1393) When modules are present, INFO's response will contain a `modules` key which will be a list of dicts describing each module. Co-authored-by: jiekun.zhu --- redis/client.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/redis/client.py b/redis/client.py index 1560c96..42d1bfa 100755 --- a/redis/client.py +++ b/redis/client.py @@ -141,7 +141,13 @@ def parse_info(response): key, value = line.split(':', 1) if key == 'cmdstat_host': key, value = line.rsplit(':', 1) - info[key] = get_value(value) + + if key == 'module': + # Hardcode a list for key 'modules' since there could be + # multiple lines that started with 'module' + info.setdefault('modules', []).append(get_value(value)) + else: + info[key] = get_value(value) else: # if the line isn't splittable, append it to the "__raw__" key info.setdefault('__raw__', []).append(line) -- cgit v1.2.1