wip
This commit is contained in:
parent
84489675ba
commit
f472de1a1d
20
app.py
Normal file
20
app.py
Normal file
@ -0,0 +1,20 @@
|
||||
from fastapi import FastAPI, Request, HTTPException
|
||||
import json
|
||||
|
||||
app = FastAPI()
|
||||
|
||||
@app.post("/endpoint")
|
||||
async def receive_info(request: Request):
|
||||
# Lire le body brut
|
||||
body = await request.body()
|
||||
print(body)
|
||||
|
||||
# Parser le JSON
|
||||
try:
|
||||
data = json.loads(body)
|
||||
except json.JSONDecodeError:
|
||||
raise HTTPException(status_code=400, detail="Invalid JSON")
|
||||
|
||||
# Debug
|
||||
print("Infos recues :", data)
|
||||
return {"status": "ok"}
|
||||
@ -283,12 +283,11 @@ json_file() {
|
||||
'{
|
||||
HARDWARE: {
|
||||
hostname:$hostname,
|
||||
mb_serial:$mb_serial,
|
||||
chassis_serial:$chassis_serial,
|
||||
cpu:$cpu,
|
||||
mb_serial:$motherboard,
|
||||
cpu_model:$cpu_model,
|
||||
cpu_id:$cpu_id,
|
||||
cpu_cores_number:$cpu_cores_number,
|
||||
cpu_threads_number:$cpu_threads_number,
|
||||
cpu_cores:$cpu_cores,
|
||||
cpu_threads:$cpu_threads,
|
||||
cpu_frequency_min:$cpu_frequency_min,
|
||||
cpu_frequency_cur:$cpu_frequency_cur,
|
||||
cpu_frequency_max:$cpu_frequency_max,
|
||||
|
||||
@ -13,11 +13,4 @@ Grabber is a bash program that fetch some informations of the computer like memo
|
||||
- v0 : grabber base, works minimal, ask permission, needs upgrades and rework
|
||||
|
||||
# Credits
|
||||
Logo inspired by [kawaiiLogos](https://github.com/SAWARATSUKI/KawaiiLogos) project
|
||||
|
||||
python3 -m venv gbvenv
|
||||
182 source gbvenv/bin/activate
|
||||
183 pip install --upgrade pip
|
||||
184 python -m pip install fastapi
|
||||
185 pip freeze >> requirements.txt
|
||||
186 echo ¨gbvenv¨ >> .gitignore
|
||||
Logo inspired by [kawaiiLogos](https://github.com/SAWARATSUKI/KawaiiLogos) project
|
||||
Reference in New Issue
Block a user