Heimdall API SDK for Python
Official Python SDK for the Heimdall Power External API.
Documentation
- Getting started and authentication
- Concepts: assets, measurement points and API modules.
- Use cases: integration flows, aggregation and polling cadence.
- User Guide (customer login required): DLR and fallback rating details.
- Examples
Installation
Requires Python 3.11+.
pip install heimdallpower-api-client
Wheels are also attached to each GitHub release, e.g.:
pip install https://github.com/heimdallpower/api-sdk/releases/download/python-v1.2.3/heimdallpower_api_client-1.2.3-py3-none-any.whl
Quick start
from heimdall_api_client import HeimdallApiClient
client = HeimdallApiClient(client_id="your_client_id", client_secret="your_client_secret")
assets = client.get_assets()
Iterate over instrumented lines
Not every line has Neurons installed.
Data endpoints return 404 or no data for lines without active measurement points.
get_instrumented_lines() returns only lines with at least one active measurement point, with their facility.
for instrumented in client.get_instrumented_lines():
current = client.get_latest_current(instrumented.line.id)
print(instrumented.facility.name, instrumented.line.name, current.data.current.value, current.data.unit)
Already have the assets? Use instrumented_lines(assets.data) from heimdall_api_client.assets.
Error handling and retry
Automatic retry
All methods retry up to 3 times with exponential backoff (1 s → 2 s → 4 s) on these transient errors:
| Condition | Description |
|---|---|
502 Bad Gateway |
The gateway could not reach the upstream server |
503 Service Unavailable |
Server temporarily unavailable |
504 Gateway Timeout |
Upstream server did not respond in time |
- Each retry logs a
WARNING. - After 3 failed retries, the last
HeimdallApiErroris raised. 500 Internal Server Erroris not retried.
Exceptions
All methods raise HeimdallApiError on non-transient errors. status_code holds the HTTP status.
from heimdall_api_client import HeimdallApiClient, HeimdallApiError
client = HeimdallApiClient(client_id="...", client_secret="...")
try:
dlr = client.get_latest_heimdall_dlr(line_id=line_id)
except HeimdallApiError as e:
if e.status_code == 404:
print("No data for the line in the requested window, or unknown line")
else:
print(f"API error {e.status_code}: {e}")
Timeouts
Pass timeout (seconds) to the constructor. It applies to every request and each retry.
import httpx
from heimdall_api_client import HeimdallApiClient
# Simple: abort any request that takes longer than 10 s
client = HeimdallApiClient(client_id="...", client_secret="...", timeout=10.0)
# Fine-grained: separate connect and read timeouts
client = HeimdallApiClient(
client_id="...",
client_secret="...",
timeout=httpx.Timeout(connect=5.0, read=30.0),
)
- There is no cancellation token; use
timeoutto bound each request. httpx.TimeoutExceptionis raised when the timeout is exceeded.
License
This SDK is licensed under the Apache License 2.0.
Metadata
Release files for heimdallpower-api-client 5.0.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 | |
|---|---|---|---|
| heimdallpower_api_client-5.0.0.tar.gz | 67.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| heimdallpower_api_client-5.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 293.1 kB
Release files / heimdallpower_api_client-5.0.0.tar.gz
| Download URL | heimdallpower_api_client-5.0.0.tar.gz |
|---|---|
| Size | 67.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cd9517d3eddd04997cf7b9346dd75f28f8c52c7f64a7f46257cc675f566ca41d
|
|
BLAKE2b-256 checksum How to use checksums |
131da54537a2ccac052a81da8d5fa21863409e8a4d5e0b072ed4f26cdedea352
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 1, 2026.
Transparency logRelease files / heimdallpower_api_client-5.0.0-py3-none-any.whl
| Download URL | heimdallpower_api_client-5.0.0-py3-none-any.whl |
|---|---|
| Size | 226.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b7fb3f085e0165ad49c8fdaf1c8e087ac6780a634a4d82e995117bb3ab56b013
|
|
BLAKE2b-256 checksum How to use checksums |
3dbc78304bb25e3e9886c41ef57e891e744dfcb8b4db8d69fb78e2dd5e47accf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 1, 2026.
Transparency log