2

我正在使用以下代码使用 Python Tweetstream 库从 twitter 获取推文,但是如果我使用某些没有意义的词或没有推文的词,则流媒体会卡住。我想在特定时间后暂停流式传输,比如 60 秒。我怎样才能做到这一点?

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
4

0 回答 0