twitter api not working simple command
Question: I am trying to extract tweets from a user using python. It is 3 lines of code,
but python is giving me a hard time.

    
    
    >>> import twitter
    >>> api = twitter.Api()
    Traceback (most recent call last):
      File "<pyshell#4>", line 1, in <module>
        api = twitter.Api()
    AttributeError: 'module' object has no attribute 'Api'
    

and the final line of code would be:

    
    
    >>> status = api.GetUserTimeline('username')
    

how do I fixed that 2nd line's error. I have python 3.2.2.3


Answer: You need to authenticate first:

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

The consumer key, consumer secret, access_token, and access_token_secret are
found on the Twitter Development Page: <https://dev.twitter.com/apps>

Use it to create a fake app and it'll give you the information you need.

If you need more help, here is website: <https://code.google.com/p/python-
twitter/>

Cheers

