Tweepy StreamWatcher Example
Pergunta
I'm just started playing with Tweepy and have it installed. I've done basic oauth stuff with it, so I know that everything is good to go.
The problem I'm having is using this StreamWatcher example that I found a lot of people pointing to:
https://github.com/tweepy/examples/blob/master/streamwatcher.py
When I run it prompts me for my username and password and directly afterwards crashes with this error:
TypeError: __init__() takes exactly 3 arguments (4 given)
I'm stuck...
Solução
Try this:
# 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)
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow