Make sure you have latest version of tweepy installed.
In [7]:
pipinstalltweepy
Let us check the version of tweepy installed.
In [8]:
pipshowtweepy
Let us see if we can use tweepy now.
In [3]:
importtweepy
In [5]:
auth=tweepy.OAuth1UserHandler(consumer_key,consumer_secret,access_token,access_token_secret)api=tweepy.API(auth)public_tweets=api.home_timeline()fortweetinpublic_tweets:print(tweet.text)break
Ok so far so good, Let us try the api.search() method now.
In [6]:
fortweetsinapi.search(q="aapl",lang="en"):print(tweets)
In tweepy 4.0.0 and above versions, api.search has been replaced with api.search_tweets()
In [11]:
tweets=api.search_tweets(q="aapl",lang="en")
In [17]:
len(tweets)
Out[17]: