File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change 1- #This code is made by MRayan Asim
2- #Packages needed:
3- #pip install requests
1+ # This code is made by MRayan Asim
2+ # Packages needed:
3+ # pip install requests
44import requests
55import time
66
7+
78def check_website_connectivity (url ):
89 try :
910 start_time = time .time ()
@@ -15,11 +16,14 @@ def check_website_connectivity(url):
1516 print (f"The website { url } is reachable." )
1617 print (f"Response time: { speed :.2f} seconds" )
1718 else :
18- print (f"Error: The website { url } returned a status code { response .status_code } ." )
19+ print (
20+ f"Error: The website { url } returned a status code { response .status_code } ."
21+ )
1922 except requests .RequestException as e :
2023 print (f"Error: Unable to connect to the website { url } ." )
2124 print (f"Exception: { e } " )
2225
26+
2327if __name__ == "__main__" :
2428 user_url = input ("Enter the website URL: " )
2529 check_website_connectivity (user_url )
You can’t perform that action at this time.
0 commit comments