I'm trying to scrape some tweets from Twitter using the twitter `package` and the following code:

```
>>> CONSUMER_KEY = 'xxxxxxxxxxxxxxxxxxxxxxx'
>>> CONSUMER_SECRET = 'xxxxxxxxxxxxxxxxxxxxxxx'
>>> OAUTH_TOKEN = 'xxxxxxxxxxxxxxxxxxxxxxx'
>>> OAUTH_TOKEN_SECRET = 'xxxxxxxxxxxxxxxxxxxxxxx'
>>> auth = twitter.oauth.OAuth(OAUTH_TOKEN_SECRET, OAUTH_TOKEN, CONSUMER_SECRET, CONSUMER_KEY)
>>> twitter_api = twitter.Twitter(auth=auth)
>>> print twitter_api
<twitter.api.Twitter object at 0x1085a7550>
>>> q = '#xxxxxxx'
>>> count = 100
>>> search_results = twitter_api.search.tweets(q=q, count=count)

```

After the last line above I get a bunch of lines and the last line detailing the error states:

```
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  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&oauth_consumer_key=XXXXXXXXX&oauth_nonce=18110930768465666531&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1383724916&oauth_token=XXXXXXXXX&oauth_version=1.0&q=%23IdolsSA&oauth_signature=JGsmTXBIAHsX6Tq6bKjLPww%2B9SE%3D)
details: {"errors":[{"message":"Invalid or expired token","code":89}]}

```

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.

What could I be doing wrong?

Thanks