Created
July 9, 2013 16:25
-
-
Save jbochi/5958832 to your computer and use it in GitHub Desktop.
Script to monitor an URL for changes
This file contains 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 characters
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) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage: