无法使用 Tweepy Streaming 连接到 Twitter

Can not connect to Twitter using Tweepy Streaming

正在尝试检查连接是否建立,但没有任何反应

我用on_connect看懂了,但是一无所获:

import tweepy
import time

class InOutStreamListener(tweepy.StreamListener):
    def on_connect(self):
        print 'Connected'    

    def disconnect(self):
        if self.running is False:
            return
        self.running = False

    def on_friends(self, friends):
        print friends[0]

auth = tweepy.OAuthHandler('code', 'code')
auth.set_access_token('code', 'code')

l = InOutStreamListener()    
streamer = tweepy.Stream(auth, l)

time.sleep(15)    
streamer.disconnect()

您只创建了一个 Stream,您没有启动它,请参阅 docs

In this example we will use filter to stream all tweets containing the word python. The track parameter is an array of search terms to stream.

myStream.filter(track=['python'])