python - Twitter - streaming API to get user tweets not working -
twiiter
api giving me hell. restrictive.
i tweets given user, so:
import json twython import twython twython import twythonstreamer #where store credentials open('creds-twitter.txt') f: creds = json.load(f) class tweetstreamer(twythonstreamer): def on_success(self, data): if 'text' in data: print data['text'].encode('utf-8') def on_error(self, status_code, data): print status_code self.disconnect() streamer = tweetstreamer(creds['consumer_key'], creds['consumer_secret'], creds['access_token'], creds['access_token_secret']) thom_yorke = '110509537' print streamer.statuses.filter(follow=thom_yorke)
1) on first try, no results. script stalls there, waiting response.
2) halt process and, on second try, use argument track
, so:
streamer.statuses.filter(track = 'radiohead', follow=thom_yorke),
it filters radiohead
, not in conjunction user's tweets.
3) then, on third try, to
print streamer.statuses.filter(follow=thom_yorke)
i 420 status_code
(limit rate). seriously? after 3 tries?
how user tweets, not hitting rate limit?
please help, driving me crazy.
Comments
Post a Comment