Skip to content

Instantly share code, notes, and snippets.

@cjpais
Last active December 18, 2020 17:25
Show Gist options
  • Save cjpais/5f9ffc5825ab78f19e0b91b673bb7f13 to your computer and use it in GitHub Desktop.
Save cjpais/5f9ffc5825ab78f19e0b91b673bb7f13 to your computer and use it in GitHub Desktop.
import urllib.request
import time
import random
while True:
try:
response = urllib.request.urlopen('https://apple.com/')
html = response.read()
except:
print("some error but graceful handling (aka ignoring)")
dur = random.randint(0,240)
print("Goodnight Moon. Sleeping for {}sec".format(dur))
time.sleep(dur)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment