-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsimplePyFetch.py
More file actions
36 lines (29 loc) · 1.13 KB
/
Copy pathsimplePyFetch.py
File metadata and controls
36 lines (29 loc) · 1.13 KB
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
#AUTHOR: Ru1722
#PROGRAM NAME: simplePyFetch
#DESCRIPTION: A simple python system fetch tool
#VERSION: 1.1
#DEV NOTES: Simplified the code by using uptime from the subrpocess library to call the uptime command from the shell.
import platform
import psutil
from termcolor import colored
from datetime import datetime
import time
import subprocess
uname = platform.uname()
#You can change color and attribute to the text below
color = 'green'
attribute = 'blink'
boot_time_timestrap = psutil.boot_time()
boottime = datetime.fromtimestamp(boot_time_timestrap)
uptimeOutput = subprocess.check_output(['uptime'])
decodeUptime = uptimeOutput.decode('utf-8').strip()
OS = colored("OS: ",color,attrs = [attribute])
CPU = colored("CPU: ",color,attrs = [attribute])
Name = colored("SYSTEM NAME: ",color,attrs = [attribute])
BT = colored("BOOT TIME: ",color,attrs = [attribute])
UT = colored("SYSTEM UPTIME:",color,attrs = [attribute])
print(OS,platform.release())
print(CPU,platform.architecture()[0])
print(Name,platform.system())
print(BT,boottime.hour,":",boottime.minute,":",boottime.second,)
print(UT,decodeUptime)