Python program to test if website is down.

Check if site is down use case.

There is a nice online web service "Is It Down Right Now" that monitors the status of our favorite web sites and checks whether they are reachable or not.

Normally user enters the url and a fresh site status test will be performed on the domain name in real time using online website checker tool. More detailed information also available like check response time graph and user comments.

Website is it down test.

This Python test script below will use information from "Is It Down Right Now" and present it in text form without the need to use a web browser.
The program will form GET request with website address that you enter and will read response and prints out reachability status and details.

Python code to test if website is down:

import re
import requests

website = ''

isitdown_url = f'{website}'

r = requests.get(isitdown_url)

r_text = (r

status = (re
          .compile(f'{domain} is (.*) (?:it is not|and reachable)') 
          .split(' ')

print(f'The website status is: {status}')
print(f'\n Additional information: {r_text}')

is site reachable.

See also related topics: