Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AttributeError: 'module' object has no attribute 'Api'

Tags:

python

twitter

I have written some basic Python code to try authenticate my credentials on twitter:

import twitter

api = twitter.Api(consumer_key='',
                      consumer_secret='',
                      access_token_key='',
                      access_token_secret='')

But I receive the following error message when doing so:

Traceback (most recent call last):
  File "C:\Python33\nettest.py", line 3, in <module>
    api = twitter.Api(consumer_key='',
AttributeError: 'module' object has no attribute 'Api'

Can anyone see what I am doing wrong? I have tried variations on this code but they all seem to fall down with the api part of the twitter 1.14.2 that i am using. i have installed this module via pip 3.3 to my python 3.3 directory. when i look in lib>site_packages>twitter i can see that there is a module installed called api. I'm really not sure what is going wrong as this should seemingly be a simple piece of code to run.

Any ideas?

like image 738
gdogg371 Avatar asked Nov 24 '25 19:11

gdogg371


1 Answers

  • simply uninstall twitter sudo pip uninstall twitter
  • Now install python-twiiter sudo pip install python-twitter... and it works..
like image 67
Godwin Avatar answered Nov 26 '25 18:11

Godwin