Compare commits

..

No commits in common. "b71ff80139666c20295ab45e1c9148a04d7a9775" and "908e65b0289cbe36ec851960b8030d1ddfb932a6" have entirely different histories.

2 changed files with 2 additions and 16 deletions

View File

@ -3,13 +3,10 @@
# @Email :508737091@qq.com
# @Author :qiangyanwen
# @File :sys_monitor_api.py
import time
from fastapi import APIRouter, Body, Depends, Query,WebSocket,WebSocketDisconnect
from fastapi import APIRouter, Body, Depends, Query
from utils.mem import get_disk_info, get_sys_info, get_cpu_info, ge_mem_info
from utils.response import success_200
from fastapi.responses import HTMLResponse
from utils.websocket_manager import manager
router = APIRouter(prefix="/api", tags=["系统模块"])
@ -32,13 +29,3 @@ async def get_cpu():
@router.get("/sys/memory", summary="获取内存信息", name="获取内存信息")
async def get_mem():
return success_200(data=await ge_mem_info(), message="查询内存信息成功")
@router.websocket("/ws")
async def websocket_endpoint(
websocket: WebSocket
):
await websocket.accept()
while True:
data = await websocket.receive()
await websocket.send_text(f"消息是: {data}")

View File

@ -35,6 +35,5 @@ async def errors_handling(request: Request, call_next):
})
)
if __name__ == '__main__':
uvicorn.run(app="main:app", host="127.0.0.1", port=settings.PROJECT.PORT, reload=Debug, loop="asyncio")
uvicorn.run(app="main:app", host=host, port=settings.PROJECT.PORT, reload=Debug)