from twitter import Twitter
t = Twitter(
auth=OAuth(
oauth_token, oauth_token_secret,
CONSUMER_KEY, CONSUMER_SECRET
)
)
pythonTweets = t.search.tweets(q = "#python")
print(pythonTweets)
它返回 NameError Traceback(最近一次调用最后一次) in()
1 from twitter import Twitter
----> 2 t = Twitter(auth=OAuth('xxxxx','xxxxx',
3 'xxxxx','xxxxx'))
4 pythonTweets = t.search.tweets(q = "#python")
5 print(pythonTweets)
NameError:name' OAuth'未定义
答案 0 :(得分:2)
解决方案是从Twitter SDK导入OAuth。将行更新为:
bootstrap