I received the following error message when I ran the code. The code should return the tweets that match the specified query. Did Twitter block the search attribute?
Error Message
for tweets in api.search(q="iphone", lang="en"):
AttributeError: 'API' object has no attribute 'search'
Code:
import tweepy
consumer_key = "XX"
consumer_secret = "XX"
access_token = "XX"
access_token_secret = "X"# Creating the authentication object
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
# Setting your access token and secret
auth.set_access_token(access_token, access_token_secret)
# Creating the API object while passing in auth information
# Creating the API object while passing in auth information
# Creating the API object while passing in auth informationapi = tweepy.API(auth)for tweets in api.search(q="iphone", lang="en"):print(tweet.text)