Anaconda Nameerror

时间:2015-02-06 15:00:53

标签: python-2.7 twitter anaconda

from twitter import *

# Change to your keys
oauth_token = "aaa"
oauth_secret = "bbb"
consumer_key = "ccc"
consumer_secret = "ddd"

with open('football_terms.txt') as f:
    vocab = [term.replace('\n', '') for term in f.readlines()]

with open('football_teams.txt') as f:
    for line in f:
        vocab.append(line.replace('\n', ''))

track_params = ','.join(vocab)

twitter_stream = TwitterStream(auth=OAuth(oauth_token, 
                                          oauth_secret, 
                                          consumer_key, 
                                          consumer_secret))

iterator = twitter_stream.statuses.filter(track=track_params,language='en')

for tweet in iterator:
    if 'text' in tweet:
        print tweet

执行程序时,会出现错误NameError:' TwitterStream'没有定义 即使安装了Twitter 1.15

之后

0 个答案:

没有答案