Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import requests
- def check_website_status(url):
- try:
- response = requests.get(url)
- if response.status_code == 200:
- print("The website is up and running.")
- else:
- print("The website is down.")
- except requests.exceptions.RequestException as e:
- print("An error occurred while trying to access the website:", str(e))
- # Example usage
- website_url = input("Enter the website URL: ")
- check_website_status(website_url)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement