included a cursor example
[twitter-api-cdsw-solutions] / twitter1-cursor.py
1 import encoding_fix
2 import tweepy
3 from twitter_authentication import CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET
4 import time
5
6 auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)
7 auth.set_access_token(ACCESS_TOKEN, ACCESS_TOKEN_SECRET)
8
9 api = tweepy.API(auth)
10
11 # I found the idea of how to the user the Cursor here:
12 #   https://tweepy.readthedocs.org/en/v3.2.0/cursor_tutorial.html
13 for page in tweepy.Cursor(api.home_timeline, count=200).pages():
14     for tweet in page:
15         print(tweet.text)
16     time.sleep(1)

Benjamin Mako Hill || Want to submit a patch?