title: Tweepy Why did I receive AttributeError for search
body: <p>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?</p>
  <p>Error Message</p>
  <pre><code>for tweets in api.search(q=&quot;iphone&quot;, lang=&quot;en&quot;):
  AttributeError: 'API' object has no attribute 'search'
  </code></pre>
  <p>Code:</p>
  <pre><code>import tweepy
  consumer_key = &quot;XX&quot;
  consumer_secret = &quot;XX&quot;
  access_token = &quot;XX&quot;
  access_token_secret = &quot;X&quot;
  
  # 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 information
  
  
  api = tweepy.API(auth)
  
  for tweets in api.search(q=&quot;iphone&quot;, lang=&quot;en&quot;):
      print(tweet.text)
  </code></pre>