Commit 776070ef authored by David Laban's avatar David Laban
Browse files

Fix bug in JSONParser.parse() which causes it to return None

Re-combine tower-of-ifs into a single if/else.

Fixes #765
parent cd46550b
......@@ -54,11 +54,11 @@ class JSONParser(Parser):
raise TweepError('Failed to parse JSON payload: %s' % e)
needs_cursors = 'cursor' in method.session.params
if needs_cursors and isinstance(json, dict):
if 'previous_cursor' in json:
if 'next_cursor' in json:
cursors = json['previous_cursor'], json['next_cursor']
return json, cursors
if needs_cursors and isinstance(json, dict) \
and 'previous_cursor' in json \
and 'next_cursor' in json:
cursors = json['previous_cursor'], json['next_cursor']
return json, cursors
else:
return json
......
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