From: David Laban Date: Tue, 26 Jul 2016 14:17:06 +0000 (+0100) Subject: Fix bug in JSONParser.parse() which causes it to return None X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=776070ef2ecd2f21347b9db50f004edb85edd423;p=tweepy.git Fix bug in JSONParser.parse() which causes it to return None Re-combine tower-of-ifs into a single if/else. Fixes #765 --- diff --git a/tweepy/parsers.py b/tweepy/parsers.py index 6381912..046cf50 100644 --- a/tweepy/parsers.py +++ b/tweepy/parsers.py @@ -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