Skip to content

json encode problem #129

@simonzen

Description

@simonzen

First, guys, thank you for the library - it's awwesome!
I use consul as a key/value storage and met the following problem.
In method consul_instance.kv.items() I got an error

Traceback (most recent call last):
File "/Users/sfokin/projects/eaas_libs/test.py", line 10, in
print(test_inst.kv.items())
File "/usr/local/lib/python3.9/site-packages/consulate/api/kv.py", line 181, in items
return [{item['Key']: item['Value']} for item in self._get_all_items()]
File "/usr/local/lib/python3.9/site-packages/consulate/api/kv.py", line 181, in
return [{item['Key']: item['Value']} for item in self._get_all_items()]
TypeError: string indices must be integers

It seems that in base.py in Response class we don't need to encode value = json.loads(body, encoding='utf-8') (line 140)
When I replaced it with this line value = json.loads(body) all worked correctly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions