1 # Do the previous step but eliminate retweets [hint: look at the tweet object!]
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(tweet.user.screen_name + "\t" + str(tweet.created_at) + "\t" + tweet.text)
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