From 24e5ac989d4b5143432cceaa76284a12060da59c Mon Sep 17 00:00:00 2001 From: Harmon Date: Sun, 25 Aug 2019 04:23:56 -0500 Subject: [PATCH] Handle empty pages in ItemIterator --- tweepy/cursor.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tweepy/cursor.py b/tweepy/cursor.py index c928208..2140ac7 100644 --- a/tweepy/cursor.py +++ b/tweepy/cursor.py @@ -217,6 +217,8 @@ class ItemIterator(BaseIterator): if self.current_page is None or self.page_index == len(self.current_page) - 1: # Reached end of current page, get the next page... self.current_page = self.page_iterator.next() + while len(self.current_page) == 0: + self.current_page = self.page_iterator.next() self.page_index = -1 self.page_index += 1 self.num_tweets += 1 -- 2.25.1