Add parameter token for api fastapi_get_network_geometries
This commit is contained in:
5
main.py
5
main.py
@@ -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}"
|
||||
|
||||
Reference in New Issue
Block a user