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
|
from fastapi import FastAPI, Request, HTTPException
|
||||||
import json
|
import json
|
||||||
|
from ordinateur import ordinateur
|
||||||
app = FastAPI()
|
app = FastAPI()
|
||||||
|
|
||||||
@app.post("/endpoint")
|
@app.post("/endpoint")
|
||||||
@ -19,4 +19,17 @@ async def receive_info(request: Request):
|
|||||||
|
|
||||||
# Debug
|
# Debug
|
||||||
print("Infos reçues :", data)
|
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"})
|
return ({"status": "ok"})
|
||||||
|
|||||||
@ -26,7 +26,7 @@ class ordinateur():
|
|||||||
kernel = ""
|
kernel = ""
|
||||||
|
|
||||||
|
|
||||||
|
'''
|
||||||
def reload(self):
|
def reload(self):
|
||||||
r = requests.get("http://localhost:8000/summary.txt")
|
r = requests.get("http://localhost:8000/summary.txt")
|
||||||
r.raise_for_status()
|
r.raise_for_status()
|
||||||
@ -74,6 +74,7 @@ class ordinateur():
|
|||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.reload()
|
self.reload()
|
||||||
|
'''
|
||||||
|
|
||||||
def shutdown():
|
def shutdown():
|
||||||
return
|
return
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user