Skip to content

Instantly share code, notes, and snippets.

@jbochi
Created July 9, 2013 16:25
Show Gist options
  • Save jbochi/5958832 to your computer and use it in GitHub Desktop.
Save jbochi/5958832 to your computer and use it in GitHub Desktop.
Script to monitor an URL for changes
import urllib
from time import sleep
from hashlib import md5
import sys
def bell():
sys.stdout.write('\a')
sys.stdout.flush()
def dig():
return md5(urllib.urlopen(sys.argv[1]).read()).digest()
print 'Monitoring %s' % sys.argv[1]
d = dig()
while dig() == d:
sleep(1)
print 'Changed!!!!!'
for i in xrange(10):
bell()
sleep(0.5)
@jbochi
Copy link
Author

jbochi commented Jul 9, 2013

Usage:

$ python monitor.py "http://example.com/"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment