Skip to main content

Alarm and Events SDK

Read-only Python library for the Equinor IOC IIOT Alarm and Events API, using authentication supported by eq-api-connector (delegated user_impersonation by default). Python 3.10 or later is required by the connector.

Install

pip install alarm-events-client

Authentication

Setting Default
Calling client ID 98fe146b-2687-4db9-9c84-45f4cd9063af
Tenant ID 3aa4a235-b6e2-48d5-9195-7fcf05b459b0
Delegated scope 6df18f43-f499-4470-9d94-52b01698620d/user_impersonation
Base URL https://api.gateway.equinor.com/iiot/ae/v1

Authentication defaults to delegated user_impersonation; the first request may prompt for browser sign-in. client_secret, user_assertion, and other eq-api-connector authentication inputs can be supplied at construction. Keep secrets and tokens out of source control and logs; this SDK does not use an APIM key.

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), events[0].source_name)

Each result from get_all_events() is an Event instance. Known API fields are available as snake_case attributes (for example, event.timestamp, event.priority, and event.other_fields), while the original API field names remain available by key (for example, event["sourceName"]). Use event.to_dict() for a plain dictionary or event.to_json(indent=2) for a JSON string. Pass as_dict=True to get_all_events() to return plain dictionaries instead.

Facility and event demo

Run the demo to fetch events and save them to ae_events.json:

uv run python examples/facility_events_demo.py

It checks JCA, JSV, and GRA over a 4-hour window ending 24 hours before the run. Edit the constants in examples/facility_events_demo.py to change its settings.

Pass supported eq-api-connector authentication inputs such as client_secret or user_assertion to AlarmEventsClient as needed. The API base URL is fixed; TLS verification remains enabled, redirects are rejected, and every request has a timeout (default 60 s).

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. A missing or null totalCount is treated as unknown; in that case, retrieval completeness is verified by following continuation tokens through the terminal page. Invalid counts or a count smaller than the page's item list raise InvalidResponseError.

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() calls GET /sources, not /facilities.
  • get_events() calls GET /events/{facility} and returns an EventPage; its items are raw dictionaries and .events converts them on demand.
  • get_all_events() follows continuation tokens, verifies totalCount when supplied, and returns a complete list or raises IncompleteResultError.
  • iter_event_pages() verifies completeness only if consumed to exhaustion.
  • Repeated tokens, changing counts, missing items, the max_pages bound, and the service's 100,000-event ceiling raise IncompleteResultError. Narrow the window or source filter rather than assuming a capped result is complete.
  • HTTP errors (including redirects) raise AlarmEventsAPIError with status_code and trace_id when 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 from the connector. Malformed JSON or response envelopes raise InvalidResponseError. 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 pre-commit install
uv run pre-commit run --all-files
uv build

The installed hook runs pytest, Black, isort, flake8, and mypy when source or test files change.

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.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for alarm-events-client 0.1.2
File Size Uploaded Provenance Actions
alarm_events_client-0.1.2.tar.gz 8.8 kB Without provenance Details for alarm_events_client-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for alarm-events-client 0.1.2
File Interpreter ABI Platform Actions
alarm_events_client-0.1.2-py3-none-any.whl Python 3 none any Details for alarm_events_client-0.1.2-py3-none-any.whl

Total release size: 18.9 kB

Release files / alarm_events_client-0.1.2.tar.gz

Download URL alarm_events_client-0.1.2.tar.gz
Size 8.8 kB
Tags Source
SHA-256 checksum
How to use checksums
dd0d52cf9758a7aacfb02414cca0f58bf5d0b266151f8a30027e9e9948178434
BLAKE2b-256 checksum
How to use checksums
0bbaa75bdd46561da6c8952b8be532f78ad150ea2a771a520da9458ee075eb27
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.2-py3-none-any.whl

Download URL alarm_events_client-0.1.2-py3-none-any.whl
Size 10.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
317e6f7d7301da123354472765ed971b19ccd6652e338cba01042c17f2c257df
BLAKE2b-256 checksum
How to use checksums
d475b7547a2d3fcf78d7bfeb83d64d6fc54758176fc064f896f30738a3e9ff9c
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.2

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page