Created
November 22, 2016 02:20
-
-
Save saltlakeryan/e29a69c1e44f052a06ddc017dec4f720 to your computer and use it in GitHub Desktop.
This file contains hidden or 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, pprint, time, random, datetime | |
check_url = 'http://something' | |
notify_url = 'http://something' | |
#pprint.pprint(r.text) | |
while True: | |
print(datetime.datetime.now()) | |
r = requests.get(check_url) | |
print("Status: %s" % r.status_code) | |
if 'fantastic' in r.text: | |
r2 = requests.post(notify_url) | |
print ("found") | |
minutes = (10 + random.random() * 5) | |
seconds = minutes * 60 | |
print("sleeping %s minutes (%s seconds)" % (minutes, seconds)) | |
time.sleep(seconds) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment