Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Heimdall API SDK for Python

The official Python SDK for accessing the Heimdall Power External API.

Getting Started

Requirements

Install dependencies:

curl -sSL https://install.python-poetry.org | python3 -
poetry install

Installing the SDK

The package is published to PyPI:

pip install heimdallpower-api-client

Alternatively, it can be downloaded and installed using the GitHub release artifacts:

pip install https://github.com/heimdallpower/api-sdk/releases/download/python-v1.2.3/heimdallpower_api_client-1.2.3-py3-none-any.whl

Replace the version and filename with the latest from Releases

Usage Example

from heimdall_api_client import HeimdallApiClient
import logging
import pprint

logging.basicConfig(level=logging.INFO)

client = HeimdallApiClient(
    client_id="your_client_id",
    client_secret="your_client_secret",
)

assets = client.get_assets()
pprint.pprint(assets)

More examples can be seen in the examples folder.

Error Handling and Retry

The SDK handles transient infrastructure errors automatically so your application does not have to.

Automatic retry

All methods on HeimdallApiClient retry up to 3 times with exponential backoff (1 s → 2 s → 4 s) on the following transient conditions:

Condition Description
502 Bad Gateway Reverse proxy / Application Gateway could not reach the upstream server
503 Service Unavailable Server temporarily unavailable
504 Gateway Timeout Upstream server did not respond in time

A WARNING log line is emitted for each retry attempt. If all 3 retry attempts are exhausted, a HeimdallApiError is raised with the status code of the last failed response.

Note: 500 Internal Server Error is not retried as it typically indicates a permanent application-level error.

Exceptions

All methods raise HeimdallApiError on non-transient errors. The status_code attribute holds the HTTP status code.

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("Line not found")
    else:
        print(f"API error {e.status_code}: {e}")

Timeouts

Pass a timeout (in seconds) to the constructor. It applies to every request, including each retry attempt.

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),
)

Note: Python synchronous code has no native cancellation equivalent to .NET's CancellationToken. Use timeout to bound how long each request may take. httpx.TimeoutException is raised if the timeout is exceeded.

Metadata

Release files for heimdallpower-api-client 4.0.1rc1

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

Source distribution (sdist)

Source distribution for heimdallpower-api-client 4.0.1rc1
File Size Uploaded
heimdallpower_api_client-4.0.1rc1.tar.gz 60.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for heimdallpower-api-client 4.0.1rc1
File Interpreter ABI Platform
heimdallpower_api_client-4.0.1rc1-py3-none-any.whl Python 3 none any Details

Total release size: 264.2 kB

Release files / heimdallpower_api_client-4.0.1rc1.tar.gz

Download URL heimdallpower_api_client-4.0.1rc1.tar.gz
Size 60.5 kB
Tags Source
SHA-256 checksum
How to use checksums
81d24869c071254b854414f0e60c8d113b9e3dc14bd5192b77dd4fc97a03dc6f
BLAKE2b-256 checksum
How to use checksums
52410b09a2ce2fa5241f9b6e1b219ae241c08bc75931ba310fc3fa624419ebf6
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 Sep 18, 2026.

Transparency log

Release files / heimdallpower_api_client-4.0.1rc1-py3-none-any.whl

Download URL heimdallpower_api_client-4.0.1rc1-py3-none-any.whl
Size 203.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d9d22a8316d40de240320d1103c0a4ae2371146c15b0cf00d120e7a23bf53483
BLAKE2b-256 checksum
How to use checksums
fddd2c3d3c421ef740de76acfa8acfd61d65c531ef8c891fc962ec7ee969e391
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 Sep 18, 2026.

Transparency log

Release history Release notifications | RSS feed

5.1.0

2 release files

5.0.0

2 release files

This release

4.0.1rc1 This release

2 release files

4.0.0

2 release files

3.10.0

2 release files

3.9.2

2 release files

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