Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,20 @@ Usage is pretty simple:

```python
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)
configuration = {
"twitter_consumer_key": "key",
"twitter_consumer_secret": "secret",
"twitter_access_token": "token",
"twitter_access_token_secret": "secret",
}

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

# if you aren't on a running ioloop...
from tornado.ioloop import IOLoop
Expand All @@ -24,5 +29,3 @@ 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.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
argparse==1.2.1
httplib2==0.7.4
nose==1.1.2
oauth2==1.5.211
oauthlib==0.6.3
tornado==2.3
wsgiref==0.1.2
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@
url = "http://github.com/joshmarshall/tweetstream",
license = "http://www.apache.org/licenses/LICENSE-2.0",
py_modules=['tweetstream',],
install_requires=['tornado', "oauth2"]
install_requires=['tornado', "oauthlib"]
)
4 changes: 3 additions & 1 deletion tests.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import print_function

from tornado.testing import AsyncTestCase
import tweetstream
import logging
Expand Down Expand Up @@ -28,7 +30,7 @@ def test_twitter_stream(self):
result = {}
def error_callback(error):
result["error"] = error
print error
print(error)
self.stop()

configuration = {
Expand Down
Loading