Skip to content

Commit 26315c2

Browse files
fix(examples): correct Indonesia compliance example API [skip-runtime-e2e] (#208)
* fix(examples): correct Indonesia compliance example API calls - Use `endpoint` instead of `agent_url` in AxonFlow constructor - Use `AuditSearchRequest(limit=5)` instead of `limit=5` kwarg - Import `ListStaticPoliciesOptions` from `axonflow.policies` - Use `getattr` for optional cross-border fields Signed-off-by: Saurabh Jain <dev@getaxonflow.com> Signed-off-by: Saurabh Jain <saurabh.jain@getaxonflow.com> * chore: retrigger CI for skip-runtime-e2e title Signed-off-by: Saurabh Jain <dev@getaxonflow.com> Signed-off-by: Saurabh Jain <saurabh.jain@getaxonflow.com> --------- Signed-off-by: Saurabh Jain <dev@getaxonflow.com> Signed-off-by: Saurabh Jain <saurabh.jain@getaxonflow.com>
1 parent 3158bea commit 26315c2

1 file changed

Lines changed: 13 additions & 7 deletions

File tree

examples/indonesia_compliance.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323

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

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

3333
client = AxonFlow(
34-
agent_url=agent_url,
34+
endpoint=endpoint,
3535
client_id=client_id,
3636
client_secret=client_secret,
3737
)
@@ -59,13 +59,17 @@ async def main() -> None:
5959
# 3. Query audit logs to demonstrate cross-border fields
6060
print("\nQuerying audit logs...")
6161
try:
62-
audit_resp = await client.search_audit_logs(limit=5)
62+
from axonflow.types import AuditSearchRequest
63+
64+
audit_resp = await client.search_audit_logs(
65+
AuditSearchRequest(limit=5),
66+
)
6367
print(f"Found {len(audit_resp.entries)} audit entries")
6468
for entry in audit_resp.entries:
6569
line = f" [{entry.timestamp}] type={entry.request_type} blocked={entry.blocked}"
66-
if entry.data_residency:
70+
if getattr(entry, "data_residency", None):
6771
line += f" residency={entry.data_residency}"
68-
if entry.transfer_basis:
72+
if getattr(entry, "transfer_basis", None):
6973
line += f" basis={entry.transfer_basis}"
7074
print(line)
7175
except AxonFlowError as e:
@@ -74,12 +78,14 @@ async def main() -> None:
7478
# 4. List policies filtered by Indonesia PII category
7579
print("\nListing Indonesia PII policies...")
7680
try:
81+
from axonflow.policies import ListStaticPoliciesOptions
82+
7783
policies = await client.list_static_policies(
78-
category=PolicyCategory.PII_INDONESIA,
84+
ListStaticPoliciesOptions(category=PolicyCategory.PII_INDONESIA),
7985
)
8086
print(f"Found {len(policies)} Indonesia PII policies")
8187
for p in policies:
82-
print(f" {p.name}: {p.description} (severity={p.severity}, action={p.action})")
88+
print(f" {p.name}: {p.description}")
8389
except AxonFlowError as e:
8490
print(f"Policy list error: {e}")
8591

0 commit comments

Comments
 (0)