MCPcopy
hub / github.com/AstrBotDevs/AstrBot / _json_or_empty

Function _json_or_empty

astrbot/dashboard/api/tools.py:40–45  ·  view source on GitHub ↗
(request: Request)

Source from the content-addressed store, hash-verified

38
39
40async def _json_or_empty(request: Request) -> dict[str, Any]:
41 try:
42 data = await request.json()
43 except Exception:
44 return {}
45 return data if isinstance(data, dict) else {}
46
47
48def _required_text(value: object, name: str) -> str:

Calls 1

jsonMethod · 0.45

Tested by 1