1

I am trying to instantiate the api for twitter. It still gives me the same error.

>>> import twitter
>>> api = twitter.Api(consumer_key='vzpF0LKea5c6DECWLnoINQ',
              consumer_secret='3rzfmW2X7bMCmY7wkOMQaIBrzRz0jTzeJnGm0r5D2c',  
              access_token_key='1517563807-75iFGXWHxMvzzsqrIs5W4tCb4OwFG4eisnDYRst',   
              access_token_secret='uLhhITppA9CDPyAiP7pkSgJMh45FL3X3F1jiwBBoI')
Traceback (most recent call last):
  File "<pyshell#7>", line 1, in <module>
    api = twitter.Api(consumer_key='vzpF0LKea5c6DECWLnoINQ',
AttributeError: 'module' object has no attribute 'Api'

What is wrong?

user1681664
  • 1,771
  • 8
  • 28
  • 53
  • Can you post a link to the documentation for the twitter module you're using? If it's [this one](https://pypi.python.org/pypi/twitter), that's not how you create an API client. – thomasd Jun 14 '13 at 21:07
  • @ThomasDarr this is all I want to do: http://blog.mattwaite.com/post/16942178252/using-python-to-access-tweets-from-the-command-line – user1681664 Jun 14 '13 at 21:08
  • 3
    This is a duplicate of this question: http://stackoverflow.com/questions/9291122/api-twitter-api-attributeerror-module-object-has-no-attribute-api ; and this one : http://stackoverflow.com/questions/4977883/python-twitter-api-not-found-error ; Always search error messages you get, there's a really great chance that someone else had the same problem. – halflings Jun 14 '13 at 21:08

1 Answers1

0

Make sure that you have one module named twitter. It might be the case that you have another wrapper having twitter module with no Api attribute. If you are using python-twitter, the above code should have worked. If you are using Tweepy or other wrappers, please check the way to get an Api.

Naffi
  • 710
  • 1
  • 6
  • 13