title: Python Twitter API GET request
body: <p>I'm trying to scrape some tweets from Twitter using the twitter <code>package</code> and the following code:</p>
  
  <pre><code>&gt;&gt;&gt; CONSUMER_KEY = 'xxxxxxxxxxxxxxxxxxxxxxx'
  &gt;&gt;&gt; CONSUMER_SECRET = 'xxxxxxxxxxxxxxxxxxxxxxx'
  &gt;&gt;&gt; OAUTH_TOKEN = 'xxxxxxxxxxxxxxxxxxxxxxx'
  &gt;&gt;&gt; OAUTH_TOKEN_SECRET = 'xxxxxxxxxxxxxxxxxxxxxxx'
  &gt;&gt;&gt; auth = twitter.oauth.OAuth(OAUTH_TOKEN_SECRET, OAUTH_TOKEN, CONSUMER_SECRET, CONSUMER_KEY)
  &gt;&gt;&gt; twitter_api = twitter.Twitter(auth=auth)
  &gt;&gt;&gt; print twitter_api
  &lt;twitter.api.Twitter object at 0x1085a7550&gt;
  &gt;&gt;&gt; q = '#xxxxxxx'
  &gt;&gt;&gt; count = 100
  &gt;&gt;&gt; search_results = twitter_api.search.tweets(q=q, count=count)
  </code></pre>
  
  <p>After the last line above I get a bunch of lines and the last line detailing the error states:</p>
  
  <pre><code>Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in &lt;module&gt;
    File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/twitter/api.py", line 204, in __call__
      return self._handle_response(req, uri, arg_data, _timeout)
    File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/twitter/api.py", line 235, in _handle_response
      raise TwitterHTTPError(e, uri, self.format, arg_data)
  twitter.api.TwitterHTTPError: Twitter sent status 401 for URL: 1.1/search/tweets.json using parameters: (count=100&amp;oauth_consumer_key=XXXXXXXXX&amp;oauth_nonce=18110930768465666531&amp;oauth_signature_method=HMAC-SHA1&amp;oauth_timestamp=1383724916&amp;oauth_token=XXXXXXXXX&amp;oauth_version=1.0&amp;q=%23IdolsSA&amp;oauth_signature=JGsmTXBIAHsX6Tq6bKjLPww%2B9SE%3D)
  details: {"errors":[{"message":"Invalid or expired token","code":89}]}
  </code></pre>
  
  <p>I tried generating new consumer and oauth codes and entering them but I still get the same error. I was thinking of trying to place the code in a new virtualenv.</p>
  
  <p>What could I be doing wrong?</p>
  
  <p>Thanks</p>