Add parameter token for api fastapi_get_network_geometries

This commit is contained in:
DingZQ
2025-06-22 23:08:47 +08:00
parent 641a879b59
commit 5ab7246317

View File

@@ -1772,7 +1772,10 @@ async def fastapi_get_node_coord(network: str, node: str) -> dict[str, float] |
# node type: junction, reservoir, tank
# link type: pipe, pump, valve
@app.get("/getnetworkgeometries/")
async def fastapi_get_network_geometries(network: str) -> dict[str, Any] | None:
async def fastapi_get_network_geometries(network: str, token: str) -> dict[str, Any] | None:
if token != "567e33c876a2":
raise HTTPException(status_code=401, detail="Unauthorized")
# 获取所有节点坐标# 缓存查询结果提高性能
global redis_client
cache_key = f"getnetworkgeometries_{network}"