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
4
4
import requests
5
5
import time
6
6
7
+
7
8
def check_website_connectivity (url ):
8
9
try :
9
10
start_time = time .time ()
@@ -15,11 +16,14 @@ def check_website_connectivity(url):
15
16
print (f"The website { url } is reachable." )
16
17
print (f"Response time: { speed :.2f} seconds" )
17
18
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
+ )
19
22
except requests .RequestException as e :
20
23
print (f"Error: Unable to connect to the website { url } ." )
21
24
print (f"Exception: { e } " )
22
25
26
+
23
27
if __name__ == "__main__" :
24
28
user_url = input ("Enter the website URL: " )
25
29
check_website_connectivity (user_url )
You can’t perform that action at this time.
0 commit comments