You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been thinking about this too, but it appears to me that Twitter does not support it - I can't find anything in their API to suggest it, at least. I'd love to be proved wrong though.
I did a successful implementation, but doesn't seems very good as I don't stop the current connection.
stream=tweetstream.TweetStream(configuration,ioloop=main_io_loop)
stream.fetch("/1.1/statuses/filter.json?track="+tornado.escape.url_escape(words), callback=callback)
defcheck_words():
globalwords, streamwithopen('words.txt') asfile:
#using a file for testing purposes, real implementation should use access a dbnewwords=file.read()
ifwords!=newwords:
words=newwordsprintnewwordstry:
#start another process (and twitter kills the last one), it would be good to gracefully kill the current connectionstream=tweetstream.TweetStream(configuration,ioloop=main_io_loop)
stream.fetch("/1.1/statuses/filter.json?track="+tornado.escape.url_escape(words), callback=callback)
interval_ms=1000*60scheduler=tornado.ioloop.PeriodicCallback(check_words,interval_ms,io_loop=main_io_loop)
scheduler.start()
main_io_loop.start()
except:
passfile.close()
interval_ms=1000*60scheduler=tornado.ioloop.PeriodicCallback(check_words,interval_ms,io_loop=main_io_loop)
scheduler.start()
main_io_loop.start()
It would be good to have a easy way to change tracked words once you are getting the stream feed.
The text was updated successfully, but these errors were encountered: