Skip to content

Commit

Permalink
Merge pull request #2 from istankovic/master
Browse files Browse the repository at this point in the history
Handle the case when response_json is None
  • Loading branch information
ezdac authored Aug 17, 2021
2 parents 006e65e + 20c0fc6 commit 776b9bf
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/raiden_api_client/wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,13 +168,15 @@ def _handle_response(self, response):
except JSONDecodeError:
raise InvalidAPIResponse()

# For some get endpoints the result will be a list of jsons
if isinstance(response_json, list):
if response_json is None:
decoded_response = AttrDict()
elif isinstance(response_json, list):
# For some get endpoints the result will be a list of jsons
decoded_response = []
for item in response_json:
decoded_response.append(attrdict_me(item))
# If it's a single dict
else:
# If it's a single dict
decoded_response = attrdict_me(response_json)

# Successful request
Expand Down

0 comments on commit 776b9bf

Please sign in to comment.