我對tweepy api有一些問題。tweepy stream.filter()方法無法正常工作
我只是試着寫一個小的應用程序,讓我一個用戶(或多個)的狀態流,但一個就可以了,開始與;-)
現在:我的代碼是這樣即:
def main():
config = ConfigParser.ConfigParser()
config.read('twitter.cfg')
username = config.get('Twitter', 'username')
password = config.get('Twitter', 'password')
listener = StreamWatcherListener()
stream = tweepy.Stream(username, password, listener, timeout=None)
stream.filter('132897940')
在StreamWatcherListener我有打印的狀態,每當一個新的到達(一切似乎工作文本的方法「on_status」,當我嘗試stream.sample(),而不是stream.filter ())
給定的ID是我的testaccount,所以無論何時我推特,我應該得到在控制檯中的一些響應....但沒有任何反應。
當我嘗試
curl -d @following http://stream.twitter.com/1/statuses/filter.json -uAnyTwitterUser:Password
中,因爲我可以在Twitter的API找到終端,一切都正常運行。
所以,也許我錯誤地使用了filter() - 方法?
有什麼建議嗎?
-andy