404 streaming api

python

#1
from tweepy import OAuthHandler
from tweepy import Stream
from tweepy.streaming import StreamListener

class MyListener(StreamListener):

def on_data(self,data):
    try:
        with open('python.json','a') as f:
            f.write(data)
            return True
    except BaseException as e:
        print("Error on_data: %s" % str(e))
    return True

def on_error(self,status):
    print(status)
    return True
if __name__ == "__main__":

auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token_key, access_token_secret)
api = tweepy.API(auth)

twitter_stream=Stream(auth,MyListener())
twitter_stream.filter(track=['video'])

a simple example about streaming api ,but always have 404 ,before running well ,never change,suddenly unable to run…


#2

Are you able to connect to or ping stream.twitter.com at all?

404 seems like something is missing.

The same code works just fine here.


#4

i can connect stream.twitter.com ,and a few days ago ,the code i can run well,the other api like rest api running well now ,only streaming api can’t run