feat(pose_3d): POST /unlock proxy + non-regression check
This commit is contained in:
1 parent
feaab2aae7
commit
0ab0e5691c
2 files changed
+32
No files matched your search
@@ -5,6 +5,7 @@ import logging
|
||||
import re
|
||||
from typing import Any, Literal, Optional
|
||||
|
||||
import httpx
|
||||
from fastapi import APIRouter, HTTPException
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
@@ -171,3 +172,22 @@ def delete_pose(name: str) -> dict[str, Any]:
|
||||
del poses[name]
|
||||
set_config_value(["pose_3d", "named_poses"], poses)
|
||||
return {"deleted": name}
|
||||
|
||||
|
||||
@router.post("/unlock")
|
||||
def post_unlock() -> dict[str, Any]:
|
||||
"""Proxy a POST {bridge}/unlock. Recovery rapido da arms: error_timeout."""
|
||||
cfg = get_config()
|
||||
key = _deps.active_robot_key()
|
||||
base = ((cfg.get("services", {}) or {}).get(key, {}) or {}).get("base_url")
|
||||
if not base:
|
||||
raise HTTPException(
|
||||
status_code=502,
|
||||
detail=f"services.{key}.base_url non configurato",
|
||||
)
|
||||
try:
|
||||
r = httpx.post(f"{base.rstrip('/')}/unlock", timeout=3.0)
|
||||
r.raise_for_status()
|
||||
except httpx.HTTPError as e:
|
||||
raise HTTPException(status_code=502, detail=f"bridge unlock: {e}")
|
||||
return r.json()
|
||||
Reference in new issue
Block a user