0

我刚开始玩 Tweepy 并安装了它。我已经用它完成了基本的 oauth 工作,所以我知道一切都很好。

我遇到的问题是使用这个 StreamWatcher 示例,我发现很多人都指向:

https://github.com/tweepy/examples/blob/master/streamwatcher.py

当我运行它时,它会提示我输入我的用户名和密码,然后直接崩溃并出现以下错误:

TypeError: __init__() takes exactly 3 arguments (4 given)

我被困住了...

4

1 回答 1

3

试试这个:

# page located at https://dev.twitter.com/apps (under "OAuth settings")
consumer_key="xxx"
consumer_secret="xxx"

access_token="xxx"
access_token_secret="xxx"

auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)

...

stream = tweepy.Stream(auth, StreamWatcherListener(), timeout=None)
于 2012-03-09T03:27:12.403 回答