84 lines
1.8 KiB
Markdown
84 lines
1.8 KiB
Markdown
Notes 9 Janvier 2026
|
|
|
|
dans ordinateur.py reproduire les fonctions grabber
|
|
boucle for ?
|
|
|
|
Explications de import, class et def (+méthode)
|
|
clé et dictionnaires
|
|
#vibe
|
|
fonction reload
|
|
|
|
attention à la tabulation !!!!! tab pas égal à espace
|
|
python3 -i ordinateur.py
|
|
#(dans le terminal)
|
|
|
|
définir ordi1(Ordinateur): dans la console/terminal
|
|
4 espaces 1ere ligne python
|
|
|
|
pipx
|
|
python3 -m http.server (dans un onglet terminal qu'on laisse ouvert)
|
|
|
|
|
|
|
|
|
|
#!/usr/in/python3
|
|
import configparser
|
|
class Ordinateur():
|
|
dictionnaire={"ordi" : "Ordinateur"}
|
|
cpu_serial=" "
|
|
mb_serial=" "
|
|
chassis_serial=" "
|
|
cpu=" "
|
|
cpu_id=" "
|
|
cpu_cores_number=" "
|
|
cpu_threads_number=" "
|
|
cpu_frequency_min=" "
|
|
cpu_frequency_cur=" "
|
|
cpu_frequency_max=" "
|
|
gpu_model=" "
|
|
ram_slots_number=" "
|
|
ram_number=" "
|
|
ram_gen=" "
|
|
ram_frequency=" "
|
|
ram_size=" "
|
|
storage_total=" "
|
|
os=" "
|
|
arch=" "
|
|
desktop=" "
|
|
wm=" "
|
|
kernel=" "
|
|
def __init__(self):
|
|
self.reload()
|
|
def reload(self):
|
|
sum=configparser.ConfigParser()
|
|
sum.read("opt/grabber/summary.txt")
|
|
|
|
if "CPU_SERIAL" in sum['HARDWARE']:
|
|
self.cpu_serial=sum['HARDWARE']['CPU_SERIAL']
|
|
|
|
if "MB_SERIAL" in sum['HARDWARE']:
|
|
self.mb_serial=sum['HARDWARE']['MB_SERIAL']
|
|
|
|
if "CHASSIS_SERIAL" in sum['HARDWARE']:
|
|
self.chassis_serial=sum['HARDWARE']['CHASSIS_SERIAL']
|
|
|
|
if "STOCKAGE_TOTAL" in sum['HARDWARE']:
|
|
self.storage_total=sum['HARDWARE']['STOCKAGE_TOTAL']
|
|
|
|
if
|
|
|
|
|
|
|
|
|
|
def shutdown():
|
|
return
|
|
def status(self):
|
|
return
|
|
def link_to_user(self,user):
|
|
return
|
|
def remove_user_access(self):
|
|
return
|
|
def show_users(self):
|
|
return
|
|
|