1 # For each original tweet, list the number of times you see it retweeted.
5 from twitter_authentication import CONSUMER_KEY, CONSUMER_SECRET, ACCESS_TOKEN, ACCESS_TOKEN_SECRET
8 auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)
9 auth.set_access_token(ACCESS_TOKEN, ACCESS_TOKEN_SECRET)
11 api = tweepy.API(auth)
14 for page in tweepy.Cursor(api.search, "community data", count=100).pages():
15 counter = counter + len(page)
17 # use the "hasattr()" function to determine if a tweet is a retweet
18 if not hasattr(tweet, 'retweeted_status'):
19 print("%s : %s " % (tweet.text, tweet.retweet_count))
21 # end this loop if we've gotten 1000
25 # This page suggests we can do one request every 5 seconds:
26 # https://dev.twitter.com/rest/reference/get/search/tweets