user1946217
user1946217

Reputation: 1753

error occurring while using 'twython'

I want to fetch tweets based on hashtags. But I get the below error.

>>> import twython
>>> TWITTER_APP_KEY = 'xxxxxx'
>>> TWITTER_APP_KEY_SECRET = 'xxxxx'
>>> TWITTER_ACCESS_TOKEN = 'xxxxxx'
>>> TWITTER_ACCESS_TOKEN_SECRET = 'xxxxx'
>>> t = twython(app_key=TWITTER_APP_KEY, 
        app_secret=TWITTER_APP_KEY_SECRET, 
            oauth_token=TWITTER_ACCESS_TOKEN, 
            oauth_token_secret=TWITTER_ACCESS_TOKEN_SECRET)

Traceback (most recent call last):
  File "<pyshell#16>", line 4, in <module>
    oauth_token_secret=TWITTER_ACCESS_TOKEN_SECRET)
TypeError: 'module' object is not callable

I do not understand why the above error occurs? Also please let me know if app_key is the same as consumer key? Please help.

Thanks

Upvotes: 0

Views: 315

Answers (1)

Nicolas Cortot
Nicolas Cortot

Reputation: 6701

See the documentation:

from twython import Twython

t = Twython(app_key=app_key,
            app_secret=app_secret,
            callback_url='http://google.com/')

In your example, you call the module twython directly instead of the class twyton.Twython.

To make your example work you need to replace import twython with from twython import Twython.

Upvotes: 2

Related Questions