Make dict.keys() PY3 compatible
The dict.keys()[0] will raise a TypeError in PY3, as dict.keys() doesn't return a list any more in PY3 but a view of list. Change-Id: Ia6c0783ca8c8514a06defbeed0fa9ef24bbd9d4a Closes-Bug: #1583419
This commit is contained in:
parent
0cdcfb5988
commit
219c334f01
@ -426,7 +426,7 @@ def from_response(response, method, url):
|
||||
pass
|
||||
else:
|
||||
if hasattr(body, "keys"):
|
||||
error = body[body.keys()[0]]
|
||||
error = body[list(body.keys())[0]]
|
||||
kwargs["message"] = error.get("message", None)
|
||||
kwargs["details"] = error.get("details", None)
|
||||
elif content_type.startswith("text/"):
|
||||
|
Loading…
x
Reference in New Issue
Block a user