Created
February 2, 2012 11:35
-
-
Save stchris/1723089 to your computer and use it in GitHub Desktop.
Revisions
-
Christian Stefanescu created this gist
Feb 2, 2012 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,32 @@ #!/usr/bin/python import pynotify import twitter import time last_id = {} users = ['heiseonline'] def notify(title, text): notification = pynotify.Notification(title, text) notification.show() def get_tweets(user): if last_id.has_key(user): s = api.GetUserTimeline(users, since_id = last_id[user]) if s: last_id[user] = s[0].id return s else: s = api.GetUserTimeline(user) last_id[user] = s[0].id return s[0:4] if __name__=='__main__': pynotify.init('heise-notify') api = twitter.Api() while True: for user in users: t = get_tweets(user) for s in t: notify("@%s" % user, s.text) time.sleep(5)