Skip to content

Instantly share code, notes, and snippets.

@pombredanne
Forked from paultag/debwatch
Created March 11, 2014 15:39
Show Gist options
  • Save pombredanne/9488356 to your computer and use it in GitHub Desktop.
Save pombredanne/9488356 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
import time
import urllib
import json
service = "http://pault.ag:8080/tail"
lastts = 0
def loop():
global lastts
while True:
f = urllib.urlopen("%s?since=%s" % (service, str(lastts)))
msgs = json.loads(f.read())
for x in msgs['messages']:
print x['text']
if lastts < x['timestamp']:
lastts = x['timestamp']
loop()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment