Skip to content

Commit

Permalink
Fix response handling of call method
Browse files Browse the repository at this point in the history
  • Loading branch information
Scott Serrano committed Oct 15, 2015
1 parent ec764ef commit ec3d75c
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions rdioapi/__init__.py
Expand Up @@ -291,14 +291,14 @@ def call(self, service_method, **args):
If there's an error then raise an appropriate exception.
"""
response_code, content = self.call_raw(service_method, **args)
if response_code != 200:
raise RdioProtocolException(response_code, content)
response = json.loads(content) or {}
if response['status'] == 'ok':
return response['result']
response, content = self.call_raw(service_method, **args)
if response.code != 200:
raise RdioProtocolException(response.code, content)
json_response = json.loads(content) or {}
if json_response['status'] == 'ok':
return json_response['result']
else:
raise RdioAPIException(response['message'])
raise RdioAPIException(json_response['message'])

def call_raw(self, service_method, **args):
"""
Expand Down

0 comments on commit ec3d75c

Please sign in to comment.