Day 9: check_site_live
This script checks if a site is active or not in the given intervals. if it's down it sends a notification.
import requests,os,time
SITE_URL=""
SLEEP_SEC=300 #5 mins
while True:
response=requests.get(SITE_URL)
print(response)
if response.status_code!=200:
os.system('notify-send "Website Down" "'+SITE_URL+'is down"')
break
time.sleep(SLEEP_SEC)
Please Visit my Git Repo to check out all the previous day challenges.
Top comments (0)