fix pagination for tweet counts
authorDarknessest <32790500+darknessest@users.noreply.github.com>
Sun, 9 Jan 2022 04:31:35 +0000 (12:31 +0800)
committerGitHub <noreply@github.com>
Sun, 9 Jan 2022 04:31:35 +0000 (12:31 +0800)
`get_all_tweets_count` is using `next_token` for pagination.
`next_token` is returned only when a difference between start and end time is more than 31 days, no matter the granularity.

tweepy/pagination.py

index 0e0b41c46675ad369c16dca951568799dd09eb06..101339456a91c56541e04e20850a95768ac1a5cf 100644 (file)
@@ -88,7 +88,8 @@ class PaginationIterator:
 
         # https://twittercommunity.com/t/why-does-timeline-use-pagination-token-while-search-uses-next-token/150963
         if self.method.__name__ in ("search_all_tweets",
-                                    "search_recent_tweets"):
+                                    "search_recent_tweets",
+                                    "get_all_tweets_count"):
             self.kwargs["next_token"] = pagination_token
         else:
             self.kwargs["pagination_token"] = pagination_token