forked from NitulKalita/Python-CLI
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathURL loadingtime.py
More file actions
Latest commit
19 lines (15 loc) · 524 Bytes
/
Copy pathURL loadingtime.py
File metadata and controls
19 lines (15 loc) · 524 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
fromurllib.requestimporturlopen
importtime
url=input("Enter the url whose loading time you want to check: ")
defget_load_time(url):
if ("https"or"http") inurl:
open_this_url=urlopen(url)
else:
open_this_url=urlopen("https://"+url)
start_time=time.time()
open_this_url.read()
end_time=time.time()
open_this_url.close()
time_to_load=end_time-start_time
returntime_to_load
print(f"\nThe time taken to load {url} is {get_load_time(url):.2} seconds.")