Skip to content

Instantly share code, notes, and snippets.

@saltlakeryan
Created November 22, 2016 02:20
Show Gist options
  • Save saltlakeryan/e29a69c1e44f052a06ddc017dec4f720 to your computer and use it in GitHub Desktop.
Save saltlakeryan/e29a69c1e44f052a06ddc017dec4f720 to your computer and use it in GitHub Desktop.
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