Created
August 29, 2018 16:07
-
-
Save emarte91/e7ec4f22bee5560db092a7e0b8f45ed0 to your computer and use it in GitHub Desktop.
Checks website status code
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 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