forked from metafy-social/python-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
37 lines (27 loc) · 815 Bytes
/
Copy pathmain.py
File metadata and controls
37 lines (27 loc) · 815 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# Internet Speed Checker
import speedtest
import time
import os
def main():
# Clear the screen
os.system('cls' if os.name == 'nt' else 'clear')
# Print the title
print('Internet Speed Checker')
# Print the current time
print(time.strftime('%H:%M:%S'))
print("Connecting to server...")
# Get the speed
s = speedtest.Speedtest()
s.get_best_server()
s.download()
s.upload()
results_dict = s.results.dict()
# Print the results
print(f"Download: {results_dict['download'] / 1024 / 1024:.2f} Mbit/s")
print(f"Upload: {results_dict['upload'] / 1024 / 1024:.2f} Mbit/s")
print(f"Ping: {results_dict['ping']:.2f} ms")
print(f"ISP: {results_dict['client']['isp']}")
# Wait 5 seconds
time.sleep(5)
if __name__ == "__main__":
main()