from fastapi import FastAPI, HTTPException
from uvicorn import run
app = FastAPI()
hwids: dict[str, str] = {}
@app.get("/hwid/{user}")
async def get_hwid(user: str):
return hwids.get(user)
@app.post("/hwid")
async def add_hwid(user: str, hwid: str):
if user in hwids:
raise HTTPException(400, {"error": "User already exists"})
hwids[user] = hwid
return {"hwid": hwid, "user": user}
if __name__ == '__main__':
run(app, host='127.0.0.1', port=8000)