Commit 138c6ceb authored by Ivo Wetzel's avatar Ivo Wetzel Committed by Joshua Roesslein
Browse files

Fix error message parsing.

parent 28e975bd
......@@ -155,7 +155,7 @@ def bind_api(**config):
self.api.last_response = resp
if resp.status != 200:
try:
error_msg = self.api.parser.parse_error(self, resp.read())
error_msg = self.api.parser.parse_error(resp.read())
except Exception:
error_msg = "Twitter error response: status code = %s" % resp.status
raise TweepError(error_msg, resp)
......
......@@ -45,7 +45,8 @@ class JSONParser(Parser):
return json
def parse_error(self, payload):
return self.json_lib.loads(payload)['error']
error = self.json_lib.loads(payload)
return error['error'] if error.has_key('error') else error['errors']
class ModelParser(JSONParser):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment