title: How to get Tweets of a Keyword
body: <p>I'm trying to get tweets from a certain keyword 'comfama'. but I can't seem to get any results. Is something wrong with my code? I'm tried with 'donald trump' and this keyword shows results but with 'comfama' nothing happens.</p>
  <pre><code>
  import tweepy
  import pandas
  import json # The API returns JSON formatted text
  
  TRACKING_KEYWORDS = ['comfama']
  OUTPUT_FILE = &quot;comfama_tweets.txt&quot;
  TWEETS_TO_CAPTURE = 10
  
  
  access_token = &quot;xxx&quot;
  access_token_secret = &quot;xxx&quot;
  consumer_key = &quot;xxx&quot;
  consumer_secret = &quot;xxx&quot;
  
  # Pass OAuth details to tweepy's OAuth handler
  auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
  auth.set_access_token(access_token, access_token_secret)
  
  class MyStreamListener(tweepy.StreamListener):
      &quot;&quot;&quot;
      Twitter listener, collects streaming tweets and output to a file
      &quot;&quot;&quot;
      def __init__(self, api=None):
          super(MyStreamListener, self).__init__()
          self.num_tweets = 0
          self.file = open(OUTPUT_FILE, &quot;w&quot;)
  
      def on_status(self, status):
          tweet = status._json
          self.file.write( json.dumps(tweet) + '\n' )
          self.num_tweets += 1
          
          # Stops streaming when it reaches the limit
          if self.num_tweets &lt;= TWEETS_TO_CAPTURE:
              if self.num_tweets % 100 == 0: # just to see some progress...
                  print('Numer of tweets captured so far: {}'.format(self.num_tweets))
              return True
          else:
              return False
          self.file.close()
  
      def on_error(self, status):
          print(status)
  
  
  # Initialize Stream listener
  l = MyStreamListener()
  
  # Create you Stream object with authentication
  stream = tweepy.Stream(auth, l)
  
  # Filter Twitter Streams to capture data by the keywords:
  stream.filter(track=[TRACKING_KEYWORDS])
  
  </code></pre>