Created
April 29, 2016 12:44
-
-
Save meetmangukiya/ed114393326d420e3e24af4a6bb36401 to your computer and use it in GitHub Desktop.
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 requests | |
import os | |
from time import sleep | |
url = input('Enter the url you want to track: ') | |
gap = int(input('Amount of time after which it should check for update(in seconds) : ')) | |
print( | |
""" | |
To terminate the program press Cmd/Ctrl + C | |
""" | |
) | |
while True: | |
time = 0 | |
content1 = requests.get(url) #Page source at time = 0 | |
while True: | |
if (time) <= gap: | |
print('Time passed: ' + str(time)) | |
sleep(10) | |
time += 10 | |
else: | |
break | |
content2 = requests.get(url) #Page source after time = gap | |
if content1.content != content2.content: #Checks whether the page source has changed | |
os.system("send-notif 'There has been some changes'") | |
print('Changed') | |
else: | |
print('Not changed!') | |
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment