]> projects.mako.cc - twitter-api-cdsw/blob - twitter1-cursor.py
Handle content-type header charset value for streaming API
[twitter-api-cdsw] / 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.4.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?