forked from Ghack9/Internet-Speed-Check-Python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSpeed.py
More file actions
26 lines (18 loc) · 721 Bytes
/
Copy pathSpeed.py
File metadata and controls
26 lines (18 loc) · 721 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
import speedtest
from tabulate import tabulate
st=speedtest.Speedtest()
class Network(object):
def __init__(self):
self.parser = speedtest.Speedtest()
def data(self):
down = str(f"{round(self.parser.download() / 1_000_000 , 2)} Mbps")
up = str(f"{round(self.parser.upload() / 1_000_000, 2)} Mbps")
servernames =[]
st.get_servers(servernames)
png=st.results.ping
return [["Interface" , "Download", "Upload","Ping"],["JioFi2_06CE6B",down,up,png]]
def __repr__(self):
speed = self.data()
return tabulate(speed, headers="firstrow", tablefmt="fancy_grid")
if __name__ == "__main__":
print(Network())