2

I am using the following code to get tweets from twitter using Python Tweetstream library but if I use certain words which have no meaning or words for which there are no tweets the streaming get stuck. I want to timeout of streaming after certain time say 60 seconds. How can I do that?

words = ["opera", "firefox", "safari"]
people = [123,124,125]
locations = ["-122.75,36.8", "-121.75,37.8"]

with tweetstream.FilterStream("username", "password", track=words,                                follow=people, locations=locations) as stream

for tweet in stream:
    print "Got interesting tweet:", tweet

0 Answers0