Skip to content

Context

client.context.load() is the SDK's dashboard-bootstrap mega-method. One call fans out ~20 sub-resource reads and gathers them into a single SessionContext snapshot — designed for "show me everything" moments like an app starting up.

Operations

Method What it does
client.context.load() Fan-out fetch — returns a SessionContext.
ctx = client.context.load()

print(len(ctx.tags), "tags,", len(ctx.sites), "sites,", len(ctx.users), "users")
print(ctx.partial, ctx.errors)

Partial-failure semantics

load() keeps going when a sub-call raises. Each failed fetch sets its field to None (or []) and records the exception in ctx.errors. ctx.partial is True when at least one sub-call raised.

if ctx.partial:
    for name, exc in ctx.errors.items():
        log.warning("context.load: %s failed: %s", name, exc)

Network-level failures (ConnectionError) abort early — there's no point continuing if the server is unreachable.

Cross-scope nodes

ctx.nodes is special: it's fetched company-scoped (the server's node list is per-company, not per-project). The SDK uses an internal per-thread scope override to clear the project header for that one call without affecting concurrent calls on the same client.

Model — SessionContext

Carries: sites, areas, floorplans, tags, tag_associations, zones, zone_prototypes, groups, alarms, notifications, notification_types, subscribers, system_subscribers, anchors, nodes, users, user_roles, tag_templates, monitor_link, helper_link, partial, errors, loaded_at (UTC stamp).

Full field list.

See also