Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions examples/indonesia_compliance.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@


async def main() -> None:
agent_url = os.environ.get("AXONFLOW_AGENT_URL", "http://localhost:8080")
endpoint = os.environ.get("AXONFLOW_AGENT_URL", "http://localhost:8080")
client_id = os.environ.get("AXONFLOW_CLIENT_ID", "")
client_secret = os.environ.get("AXONFLOW_CLIENT_SECRET", "")

Expand All @@ -31,7 +31,7 @@ async def main() -> None:
raise SystemExit(msg)

client = AxonFlow(
agent_url=agent_url,
endpoint=endpoint,
client_id=client_id,
client_secret=client_secret,
)
Expand Down Expand Up @@ -59,13 +59,17 @@ async def main() -> None:
# 3. Query audit logs to demonstrate cross-border fields
print("\nQuerying audit logs...")
try:
audit_resp = await client.search_audit_logs(limit=5)
from axonflow.types import AuditSearchRequest

audit_resp = await client.search_audit_logs(
AuditSearchRequest(limit=5),
)
print(f"Found {len(audit_resp.entries)} audit entries")
for entry in audit_resp.entries:
line = f" [{entry.timestamp}] type={entry.request_type} blocked={entry.blocked}"
if entry.data_residency:
if getattr(entry, "data_residency", None):
line += f" residency={entry.data_residency}"
if entry.transfer_basis:
if getattr(entry, "transfer_basis", None):
line += f" basis={entry.transfer_basis}"
print(line)
except AxonFlowError as e:
Expand All @@ -74,12 +78,14 @@ async def main() -> None:
# 4. List policies filtered by Indonesia PII category
print("\nListing Indonesia PII policies...")
try:
from axonflow.policies import ListStaticPoliciesOptions

policies = await client.list_static_policies(
category=PolicyCategory.PII_INDONESIA,
ListStaticPoliciesOptions(category=PolicyCategory.PII_INDONESIA),
)
print(f"Found {len(policies)} Indonesia PII policies")
for p in policies:
print(f" {p.name}: {p.description} (severity={p.severity}, action={p.action})")
print(f" {p.name}: {p.description}")
except AxonFlowError as e:
print(f"Policy list error: {e}")

Expand Down
Loading