stage12-agent-routing.py
TEXT FILE445 B · Public source code for developers, search crawlers and AI agents
1# SPDX-License-Identifier: 0BSD
2def route(role, operation):
3 allowed = {"reporter": {"balance"}, "auditor": {"utxos"}}
4 if operation not in allowed.get(role, set()):
5 raise PermissionError("denied")
6 return "/api/v5/btc/wallet/" + operation
7
8assert route("reporter", "balance").endswith("/balance")
9try:
10 route("reporter", "send")
11except PermissionError:
12 pass
13else:
14 raise AssertionError("unexpected write permission")Read-only source · Select a line number to link directly · Raw download above
