new shems

This commit is contained in:
2026-04-01 14:18:52 +05:00
parent 4e9b89fbe5
commit 22bbc3a0a6
15 changed files with 1793 additions and 133 deletions

View File

@@ -156,6 +156,30 @@ async def get_response(response_id: str) -> dict | None:
return None
async def get_radar_result(response_id: str) -> dict | None:
"""GET /responses/{response_id}/radar — данные для радарной диаграммы."""
try:
async with httpx.AsyncClient(base_url=API_URL, timeout=_TIMEOUT) as client:
resp = await client.get(f"/responses/{response_id}/radar")
if resp.status_code == 200:
return resp.json()
except Exception:
pass
return None
async def get_radar_svg_bytes(response_id: str) -> bytes | None:
"""GET /responses/{response_id}/radar/image — SVG-файл с диаграммой."""
try:
async with httpx.AsyncClient(base_url=API_URL, timeout=_TIMEOUT) as client:
resp = await client.get(f"/responses/{response_id}/radar/image")
if resp.status_code == 200:
return resp.content
except Exception:
pass
return None
async def submit_response(
poll_id: str,
answers: list[dict],