Reputation: 3511
I installed the twitter wrapper for python installed it and running it but getting this error
Traceback (most recent call last):
File "/home/siddhartha/workspace/trouveunappart/src/test.py", line 35, in <module>
sid()
File "/home/siddhartha/workspace/trouveunappart/src/test.py", line 12, in sid
t = Twitter(
NameError: global name 'Twitter' is not defined
the code is:
from twitter import *
CONSUMER_KEY = ''
CONSUMER_SECRET = ''
OAUTH_TOKEN = ''
OAUTH_SECRET = ''
t = Twitter(
auth=OAuth(OAUTH_TOKEN, OAUTH_SECRET,
CONSUMER_KEY, CONSUMER_SECRET)
)
since_ID = -1
max_ID = 0
while(since_ID != max_ID):
search = t.search.tweets(q = k, count = 100, since_id = max_ID)
print len(search['statuses'])
if len(search['statuses']) == 0:
print 'end'
break
since_ID = search['search_metadata']['since_id_str']
max_ID = search['search_metadata']['max_id_str']
Upvotes: 0
Views: 3231
Reputation: 13606
Just a guess. Is it possible that you've got another twitter library installed? I mean, import twitter
works for you, but there is not twitter.Twitter
which should be there, if you are really using python twitter tools.
For example, python-twitter doesn't have twitter.Twitter
, but has twitter.Api
which does not exist in python twitter tools. It seems that you've got python-twitter, not python twitter tools.
Upvotes: 3