Skip to content

Instantly share code, notes, and snippets.

@emarte91
Created August 29, 2018 16:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save emarte91/e7ec4f22bee5560db092a7e0b8f45ed0 to your computer and use it in GitHub Desktop.
Save emarte91/e7ec4f22bee5560db092a7e0b8f45ed0 to your computer and use it in GitHub Desktop.
Checks website status code
import requests
import time
import datetime
while True:
r = requests.get("https://thinktreeit.com")
if r.status_code != 200:
print(f'Down Status Code:{r.status_code} {datetime.datetime.now()}')
time.sleep(5)
else:
print("Website back up!")
break
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment