diff options
author | 2014bduck <2014bduck@gmail.com> | 2020-09-04 06:19:43 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-03 15:19:43 -0700 |
commit | 356da7f042d70b4b7d3808b0900c8bd1cdbac225 (patch) | |
tree | a19647acac85990fd32c8ad421f75aef9b19d45a | |
parent | 5a6a50b50db26e4b1c4b7a6cb9b2a2caa8ba5e8b (diff) | |
download | redis-py-356da7f042d70b4b7d3808b0900c8bd1cdbac225.tar.gz |
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 <jiekun.zhu@shopee.com>
-rwxr-xr-x | redis/client.py | 8 |
1 files changed, 7 insertions, 1 deletions
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) |