From 776070ef2ecd2f21347b9db50f004edb85edd423 Mon Sep 17 00:00:00 2001 From: David Laban Date: Tue, 26 Jul 2016 15:17:06 +0100 Subject: [PATCH] Fix bug in JSONParser.parse() which causes it to return None Re-combine tower-of-ifs into a single if/else. Fixes #765 --- tweepy/parsers.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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 -- 2.25.1