DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’» is a community of 964,423 amazing developers

We're a place where coders share, stay up-to-date and grow their careers.

Create account Log in
Cover image for Day 9 - Check a site is up or not - 100 days 100 python scripts
Ganesh Raja
Ganesh Raja

Posted on

Day 9 - Check a site is up or not - 100 days 100 python scripts

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)
Enter fullscreen mode Exit fullscreen mode

Please Visit my Git Repo to check out all the previous day challenges.

https://github.com/ganeshraja10/automated-python-scripts

Top comments (1)

🌚 Friends don't let friends browse without dark mode.

Just kidding, it's a personal preference. But you can change your theme, font, etc. in your settings.

The more you know. 🌈