update data
This commit is contained in:
parent
d3689d21d0
commit
1d6cb48e47
15
app.py
15
app.py
@ -1,6 +1,6 @@
|
||||
from fastapi import FastAPI, Request, HTTPException
|
||||
import json
|
||||
|
||||
from ordinateur import ordinateur
|
||||
app = FastAPI()
|
||||
|
||||
@app.post("/endpoint")
|
||||
@ -19,4 +19,17 @@ async def receive_info(request: Request):
|
||||
|
||||
# Debug
|
||||
print("Infos reçues :", data)
|
||||
ordi1 = ordinateur()
|
||||
ordi1.mb_serial = data['HARDWARE']['mb_serial']
|
||||
ordi1.hostname = data['HARDWARE']['hostname']
|
||||
ordi1.cpu = data['HARDWARE']['cpu']
|
||||
ordi1.cpu_id = data['HARDWARE']['cpu_id']
|
||||
ordi1.memory_mb = data['HARDWARE']['memory_mb']
|
||||
ordi1.ram_size = data['HARDWARE']['ram_size']
|
||||
ordi1.ram_gen = data['HARDWARE']['ram_gen']
|
||||
ordi1.sizes = data['HARWARE']['sizes']
|
||||
print(f"Le serial de la mb est {ordi1.mb_serial}")
|
||||
print(f"Hostname est {ordi1.hostname}")
|
||||
print(f"Your cpu is {ordi1.cpu}")
|
||||
print(f"Le id de ce cpu est {ordi1.cpu_id}")
|
||||
return ({"status": "ok"})
|
||||
|
||||
@ -26,7 +26,7 @@ class ordinateur():
|
||||
kernel = ""
|
||||
|
||||
|
||||
|
||||
'''
|
||||
def reload(self):
|
||||
r = requests.get("http://localhost:8000/summary.txt")
|
||||
r.raise_for_status()
|
||||
@ -74,17 +74,18 @@ class ordinateur():
|
||||
|
||||
def __init__(self):
|
||||
self.reload()
|
||||
'''
|
||||
|
||||
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
|
||||
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
|
||||
|
||||
#sum=configparser.ConfigParser()
|
||||
#sum.read("/opt/grabber/summary.txt")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user