Projekt

Obecné

Profil

Stáhnout (509 Bajtů) Statistiky
| Větev: | Tag: | Revize:
1
from fastapi import FastAPI
2
import fastapi
3
from pydantic import BaseModel
4
from typing import Optional, List
5

    
6
app = FastAPI()
7

    
8
class Device(BaseModel):
9
	vendor_id: int
10
	product_id: int
11
	serial_number: int
12

    
13
class USBLog(BaseModel):
14
	username: str
15
	hostname: str
16
	timestamp: str
17
	device: Device
18
	status:str
19

    
20
@app.post("/api/v1/usb-logs/")
21
async def root_post(usb_log: USBLog):
22
	print(usb_log)
23
	return {"message": "Sucess"}
24
	
25
@app.get("/")
26
async def root_read():
27
	print("Hello")
28
	return {"message":"Hello World"}
    (1-1/1)