Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- import datetime
- import time
- import urllib2
- def once(conf, tweets):
- for line in conf:
- line = line.replace("\r","").replace("\n", "")
- host, person = line.split()
- url = "http://{0}/~{1}/fritter.txt".format(host, person)
- f = urllib2.urlopen(url)
- tweet = f.read()
- print_tweet = True
- if tweets.has_key(url):
- if tweets[url] == tweet: print_tweet = False
- tweets[url] = tweet
- if print_tweet:
- print "At {0}, {1} at {2} wrote:".format(datetime.datetime.now(), person, host)
- print tweet
- # read configuration file
- conf = file("fritter.conf","r").read().splitlines()
- tweets = {}
- while(True):
- once(conf, tweets)
- time.sleep(5)
Add Comment
Please, Sign In to add comment