-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
50 lines (37 loc) · 1.2 KB
/
app.py
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
38
39
40
41
42
43
44
45
46
47
48
49
50
# modules
import datetime
import platform
from prettytable import PrettyTable
import fire
import speedtest
class Commands(object):
def network(self):
time = datetime.datetime.now().strftime("%H:%M")
st = speedtest.Speedtest()
table = PrettyTable()
table.title = 'newtwork speedtest'
table.field_names = ["hora", "ping", "bajada", "subida"]
st.get_best_server()
table.add_row([
time,
f"{st.results.ping} ms",
f"{round(st.download() / 1000 / 1000, 1)} Mbit/s",
f"{round(st.upload() / 1000 / 1000, 1)} Mbit/s",
])
print(table)
def system(self):
system_table = PrettyTable()
os = platform.uname()
system_table.header = False
system_table.add_rows([
["Sistema", os.system],
["Lanzamiento", os.release],
["Versión", os.version],
["Arquitectura", os.machine],
["Procesador", os.processor]
])
if os.system == 'Windows':
system_table.add_row(["Edicion", platform.win32_edition()])
print(system_table)
if __name__ == '__main__':
fire.Fire(Commands)