Handle empty pages in ItemIterator
authorHarmon <Harmon758@gmail.com>
Sun, 25 Aug 2019 09:23:56 +0000 (04:23 -0500)
committerHarmon <Harmon758@gmail.com>
Sun, 25 Aug 2019 09:23:56 +0000 (04:23 -0500)
tweepy/cursor.py

index c9282085ada68e5e3809a3659d8a01b341f62f43..2140ac7dbb1dfca2f1a099916bbc8bb45c42823f 100644 (file)
@@ -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