Skip to content

Instantly share code, notes, and snippets.

@katronai
Last active March 3, 2020 23:04
Show Gist options
  • Save katronai/cd58150a859aef719a1c370b3614a173 to your computer and use it in GitHub Desktop.
Save katronai/cd58150a859aef719a1c370b3614a173 to your computer and use it in GitHub Desktop.
Search tweets by date from Twitter using tweepy
# The following code fetches the most recent 1000 mentions of 'python'.
from tweepy import Stream
from tweepy import OAuthHandler
from tweepy.streaming import StreamListener
import tweepy
import time
ckey ='x'
csecret = 'x'
atoken = 'x'
asecret ='x'
auth = tweepy.OAuthHandler(ckey, csecret)
auth.set_access_token(atoken, asecret)
api = tweepy.API(auth)
max_tweets = 1000
for tweet in tweepy.Cursor(api.search,q='test',since='2014-07-01',until='2014-07-31', wait_on_rate_limit=True).items(max_tweets):
print tweet.text
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment