Simple Twitter Streaming client for Tornado
Python
Switch branches/tags
Nothing to show
Pull request Compare This branch is 9 commits ahead, 4 commits behind joshmarshall:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore
README.md
main.py
requirements.txt
setup.py
tests.py
tweetstream.py

README.md

The TweetStream class is just a simple HTTP client for handling the twitter streaming API.

Usage is pretty simple:

import tweetstream
tweetstream.TWITTER_APP_USER = "username"
tweetstream.TWITTER_APP_PASSWORD = "password"

def callback(message):
    # this will be called every message
    print message

stream = tweetstream.TweetStream()
stream.fetch("/1/statuses/filter.json?track=foobar", callback=callback)

# if you aren't on a running ioloop...
from tornado.ioloop import IOLoop
IOLoop.instance().start()

The constructor takes two optional arguments, ioloop and clean. The ioloop argument just lets you specify a specific loop to run on, and clean is just a boolean (False by default) that will strip out basic data from the twitter message payload.

TODO: Implement OAuth header instead of Basic Auth.