Advertisement
Ajwct

Down Detector

Nov 8th, 2023
1,266
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.47 KB | None | 0 0
  1. import requests
  2.  
  3. def check_website_status(url):
  4.     try:
  5.         response = requests.get(url)
  6.         if response.status_code == 200:
  7.             print("The website is up and running.")
  8.         else:
  9.             print("The website is down.")
  10.     except requests.exceptions.RequestException as e:
  11.         print("An error occurred while trying to access the website:", str(e))
  12.  
  13. # Example usage
  14. website_url = input("Enter the website URL: ")
  15. check_website_status(website_url)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement