def setup_transport(self): self.r_server = redis.Redis(**self.r_config) consumer = oauth.OAuthConsumer(self.consumer_key, self.consumer_secret) token = oauth.OAuthToken(self.access_token, self.access_token_secret) self.twitter = twitter.TwitterFeed(consumer=consumer, token=token) yield self.start_tracking_terms() self.start_checking_for_replies()
import sys from twisted.internet import reactor from oauth import oauth from twittytwister import twitter def cb(entry): print '%s: %s' % (entry.user.screen_name.encode('utf-8'), entry.text.encode('utf-8')) def change(monitor): monitor.args = {} monitor.connect(forceReconnect=True) consumer = oauth.OAuthConsumer(sys.argv[1], sys.argv[2]) token = oauth.OAuthToken(sys.argv[3], sys.argv[4]) feed = twitter.TwitterFeed(consumer=consumer, token=token) monitor = twitter.TwitterMonitor(feed.user, cb, {'with': 'followings'}) monitor.startService() reactor.callLater(30, change, monitor) reactor.run()
#!/usr/bin/env python """ Copyright (c) 2008 Dustin Sallings <*****@*****.**> """ import sys from twisted.internet import reactor from twisted.python import log from twittytwister import twitter def cb(entry): print entry.text twitter.TwitterFeed(sys.argv[1], sys.argv[2]).spritzer(cb).addErrback(log.err) reactor.run()
def setUp(self): self.feed = twitter.TwitterFeed() self.calls = []
#!/usr/bin/env python """ Copyright (c) 2008 Dustin Sallings <*****@*****.**> """ import sys from twisted.internet import reactor from twisted.python import log from twittytwister import twitter def cb(entry): print entry.text u, p, follows = sys.argv[1], sys.argv[2], sys.argv[3:] twitter.TwitterFeed(u, p).follow(cb, set(follows)).addErrback(log.err) reactor.run()
#!/usr/bin/env python """ Copyright (c) 2008 Dustin Sallings <*****@*****.**> """ import sys from twisted.internet import reactor from twisted.python import log from twittytwister import twitter def cb(entry): print entry.text u, p, terms = sys.argv[1], sys.argv[2], sys.argv[3:] twitter.TwitterFeed(u, p).track(cb, set(terms)).addErrback(log.err) reactor.run()