title: How do I set my result type to be recent, in tweepy python?
body: <p>I'm trying to make a twitter bot that retweets the 5 most recent posts in #fortnite on Twitter. The only problem I'm having is how do I set my result type to only be recent posts, so the bot only retweets the recent posts in #Fortnite.</p>
  <pre><code>import tweepy as twitter
  import keys
  import time, datetime
  
  auth = twitter.OAuthHandler(keys.API_KEY, keys.API_SECRET_KEY)
  auth.set_access_token(keys.ACCESS_TOKEN, keys.SECRET_ACCESS_TOKEN)
  api = twitter.API(auth)
  
  
  def twitter_bot(hashtag, delay):
    while True:
      print(f&quot;\n{datetime.datetime.now()}\n&quot;)
  
      for tweets in twitter.Cursor(api.search_tweets, q=hashtag, count=10).items(5):
        try:
          tweet_id = dict(tweets._json)[&quot;id&quot;]
          tweet_text = dict(tweets._json)[&quot;text&quot;]
  
          print(&quot;id: &quot; + str(tweet_id))
          print(&quot;text: &quot; + str(tweet_text))
  
          api.retweet(tweet_id)
  
        except:
          print(&quot;error&quot;)
  
      time.sleep(delay)
  
  twitter_bot(&quot;#Fortnite&quot;, 10)
  </code></pre>
  <p>In the Twitter API docs, it says the following -</p>
  <p>result_type</p>
  <p>Specifies what type of search results you would prefer to receive. The current default is &quot;mixed.&quot; Valid values include:</p>
  <ul>
  <li><p>mixed : Include both popular and real time results in the response.</p>
  </li>
  <li><p>recent : return only the most recent results in the response</p>
  </li>
  <li><p>popular : return only the most popular results in the response.</p>
  </li>
  </ul>
  <p>Link to docs - <a href="https://developer.twitter.com/en/docs/twitter-api/v1/tweets/search/api-reference/get-search-tweets" rel="nofollow noreferrer">https://developer.twitter.com/en/docs/twitter-api/v1/tweets/search/api-reference/get-search-tweets</a></p>
  <p>If you know how to implement this into this code, I'd appreciate the help!</p>