Alarm and Events SDK
Read-only Python library for the Equinor IOC IIOT Alarm and Events API, using delegated
user_impersonation authentication through eq-api-connector.
Python 3.10 or later is required by the connector.
Install
pip install "git+https://github.com/equinor/ioc-ae-sdk.git"
GitHub access to this internal repository is required. This package is not
published to PyPI yet; its intended distribution name is alarm-events-client.
Authentication
| Setting | Default |
|---|---|
| API application | omnia-iiot-ae-api-production |
| API resource ID | 6df18f43-f499-4470-9d94-52b01698620d |
| Delegated scope | 6df18f43-f499-4470-9d94-52b01698620d/user_impersonation |
| Calling public-client application | IOC-monitoring-sdk |
| Calling client ID | 98fe146b-2687-4db9-9c84-45f4cd9063af |
| Tenant ID | 3aa4a235-b6e2-48d5-9195-7fcf05b459b0 |
| Base URL | https://api.gateway.equinor.com/iiot/ae/v1 |
The application names, IDs and enabled delegated permission were checked against
Entra service-principal metadata on 2026-10-29. IDs are configuration, not secrets.
The calling app declares this exact delegated permission and includes
http://localhost among its public-client redirect URIs.
The calling app needs delegated permission/consent for this API, a suitable
public-client redirect configuration, and the user needs authorized API access
(including AE.Read where required). Metadata discovery alone does not verify
consent or user access.
eq-api-connector owns MSAL login, token renewal and its credential cache.
The first request may open interactive browser login; subsequent requests reuse
the connector's authentication. No client secret, application-token fallback,
Azure CLI token, or APIM subscription key is used by this SDK.
Do not print tokens or commit credential caches. Do not enable HTTP debug logging
where Authorization headers could be captured.
Usage
from alarm_events import AlarmEventsClient
with AlarmEventsClient() as client:
facilities = client.list_facilities()
events = client.get_all_events(
"TROA",
source_name="*",
start="2026-10-28T00:00:00Z",
end="2026-10-28T01:00:00Z",
)
print(len(events))
Facility and event demo
Run the demo to check STID facility codes against GET /sources and save
matching event records to a JSON file:
uv run python examples/facility_events_demo.py
By default, it checks JCA, JSV, and GRA, then retrieves events from the
last 24 hours for supported facilities. The example uses a wildcard source,
priorities 1 and 2, unacknowledged and active state filters, descending sort,
and includes other event fields. It follows continuation tokens and verifies
completeness before writing ae_events.json. A supported facility can have
zero events matching the selected time window and filters.
Override the facility codes, time window, or output path with command-line options:
uv run python examples/facility_events_demo.py \
--facilities JCA JSV GRA --hours 48 --output output/ae_events.json
Edit EVENT_FILTERS in examples/facility_events_demo.py to change the event
filters.
Override client_id, tenant_id, scope, or user_name at construction if needed.
Only explicit /user_impersonation scopes are accepted. Optional base_url and
timeout overrides support alternate HTTPS deployments. Only set base_url to a
trusted API: it receives the delegated bearer token. TLS verification remains
enabled, redirects are rejected, and every request has a timeout (default 60 s).
Single-page filtering
with AlarmEventsClient() as client:
page = client.get_events(
"TROA",
start="2026-10-28T00:00:00Z",
end="2026-10-28T01:00:00Z",
source_name="*",
priority=[1, 2],
acked_state=False,
sort="Desc",
include_other_fields=True,
limit=1000,
)
# page.items, page.total_count, page.continuation_token
All three event-reading methods accept description, event_type,
event_category, message, severity, priority, condition, alarm_state,
acked_state, active_state, suppressed_or_shelved, node, process_area,
actiontime, include_other_fields, and sort, mapping to the API's parameters.
Filters other than sort and include_other_fields accept a scalar or a
list/tuple of values; sequences are sent as repeated query parameters, not
comma-separated strings. Priority and severity accept int32 values (numeric
strings remain supported); state flags require booleans. actiontime values
require timezone offsets and are normalized to UTC.
sort is sent as the schema's Asc or Desc enum; lowercase input is also
accepted. Filters are preserved on every page.
Single-page results may be incomplete. get_events additionally accepts
continuation_token for manual paging.
The read surface was checked against the supplied iiot-ae-api-v1.yaml
OpenAPI 3.0.1 definition. Its limit schema allows 1 through 100,000, despite a
shorter conflicting description. The SDK follows that schema and retains
the conservative completeness checks below. Although the response schema
allows null collections/counts, these cannot establish completeness and raise
InvalidResponseError rather than silently becoming empty successful reads.
Both time bounds are required and must be timezone-aware datetime objects or
ISO-8601 strings with an offset; they are normalized to UTC. The facility is a
path code, and sourceName is always supplied (* by default).
Unknown keyword arguments raise TypeError, preventing misspelled time filters
from silently reading the wrong period. Events retain the API's original fields
and nulls; no alarm interpretation or personal-data transformation is performed.
Completeness and errors
list_facilities()callsGET /sources, not/facilities.get_events()callsGET /events/{facility}and returns anEventPage.get_all_events()follows continuation tokens, verifiestotalCount, and returns a complete list or raisesIncompleteResultError.iter_event_pages()verifies completeness only if consumed to exhaustion.- Repeated tokens, changing counts, missing items, the
max_pagesbound, and the service's 100,000-event ceiling raiseIncompleteResultError. Narrow the window or source filter rather than assuming a capped result is complete. - HTTP errors (including redirects) raise
AlarmEventsAPIErrorwithstatus_codeandtrace_idwhen available. Error bodies and credentials are not included in exception messages. - HTTP 401 requires checking login, scope and consent; HTTP 403 requires checking access. Neither is silently converted into an empty result.
- Network errors/timeouts propagate as
requestsexceptions. Malformed JSON or response envelopes raiseInvalidResponseError. Requests are not automatically retried; retry transient failures at the caller's policy boundary.
Streaming subscriptions are intentionally excluded: the service does not allow
delegated user_impersonation tokens for realtime subscriptions. The published
server-side count route has been observed returning 404 and is not exposed here.
Count the completely retrieved list when needed.
Development
uv sync --locked
uv run pytest --cov=alarm_events --cov-report=term-missing
uv run black --check src tests
uv run isort --check-only src tests
uv run flake8 src tests
uv run mypy
uv build
All automated tests use fake authentication and HTTP responses. They do not require sign-in or call the API. A successful offline test run is not proof of live access; validate login and a bounded facilities/event read in your own authorized environment. Keep real event data and tokens out of the repository.
Metadata
Release files for alarm-events-client 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| alarm_events_client-0.1.0.tar.gz | 9.2 kB | Without provenance | Details for alarm_events_client-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| alarm_events_client-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for alarm_events_client-0.1.0-py3-none-any.whl |
Total release size: 19.4 kB
Release files / alarm_events_client-0.1.0.tar.gz
| Download URL | alarm_events_client-0.1.0.tar.gz |
|---|---|
| Size | 9.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2a7178c01857510e2bc4493f1122d9d20e7ffbc3760279cb7b56f6e015d6faac
|
|
BLAKE2b-256 checksum How to use checksums |
63363714e34d2d66b35513c2d99a2238d273f2d673ba74956d37fc9251d4d952
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.3.3 CPython/3.13.7 Darwin/27.2.0
|
Release files / alarm_events_client-0.1.0-py3-none-any.whl
| Download URL | alarm_events_client-0.1.0-py3-none-any.whl |
|---|---|
| Size | 10.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
40164f32ec6b99ab7155f5d6f30c91654b9135fed2f24bb19505c8a690b50705
|
|
BLAKE2b-256 checksum How to use checksums |
6e4ef88c0cfbcb4f25159930b5db40cea06c8fc529bc672a974b4351c9e3486b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.3.3 CPython/3.13.7 Darwin/27.2.0
|
Security for alarm-events-client 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.