-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSpeedTest.py
More file actions
27 lines (22 loc) · 870 Bytes
/
SpeedTest.py
File metadata and controls
27 lines (22 loc) · 870 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
#!/usr/bin/env python3
import sys
import subprocess
def check_speed():
try:
import speedtest
except:
subprocess.check_call([sys.executable, '-m', 'pip', 'install', 'speedtest-cli'])
finally:
import speedtest
test = speedtest.Speedtest()
print("Checking your download speed...")
down = test.download() # tests download speed
print("Done...")
print("Now checking your upload speed...")
up = test.upload() # tests upload speed
print("Done...")
return (
"your Download Speed is {:.2f} MB PS and your Upload Speed is {:.2f} MB PS".format(down / 1024 * 0.0009765625,
up / 1024 * 0.0009765625))
if __name__ == '__main__':
check_speed()