aionatgrid
Async Python client for National Grid's GraphQL and REST APIs.
Installation
pip install aionatgrid
Quick Start
import asyncio
from aionatgrid import NationalGridClient, NationalGridConfig
async def main() -> None:
config = NationalGridConfig(
username="user@example.com",
password="your-password",
)
async with NationalGridClient(config=config) as client:
accounts = await client.get_linked_accounts()
for account in accounts:
print(account["billingAccountId"])
if __name__ == "__main__":
asyncio.run(main())
API Methods
| Method | Returns | Description |
|---|---|---|
get_linked_accounts() |
list[AccountLink] |
Get linked billing account IDs |
get_billing_account() |
BillingAccount |
Get account details (region, meters, address) |
get_energy_usage_costs() |
list[EnergyUsageCost] |
Get energy costs for a billing period |
get_energy_usages() |
list[EnergyUsage] |
Get historical usage data |
get_ami_energy_usages() |
list[AmiEnergyUsage] |
Get AMI hourly energy usage |
get_interval_reads() |
list[IntervalRead] |
Get real-time meter interval reads |
All methods return typed results using TypedDict models.
Examples
uv run python examples/list-accounts.py --username user@example.com --password secret
uv run python examples/account-info.py --username user@example.com --password secret
uv run python examples/energy-usage.py --username user@example.com --password secret
uv run python examples/interval-reads.py --username user@example.com --password secret
uv run python examples/ami-usage.py --username user@example.com --password secret
Development
Requires Python 3.10+ and uv.
uv sync # install dependencies
uv run pytest # run tests
uv run ruff check . # lint
uv run ruff format . # format
uv run mypy src # type-check
Metadata
Release files for aionatgrid 0.4.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 |
|---|---|---|---|---|
| aionatgrid-0.4.0.tar.gz | 32.4 kB | With provenance | Details for aionatgrid-0.4.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| aionatgrid-0.4.0-py3-none-any.whl | Python 3 | none | any | Details for aionatgrid-0.4.0-py3-none-any.whl |
Total release size: 61.3 kB
Release files / aionatgrid-0.4.0.tar.gz
| Download URL | aionatgrid-0.4.0.tar.gz |
|---|---|
| Size | 32.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
33786b6a18040a43183bc8ca7a43fa086e6828b7db92da44cc753dbcd1dff15f
|
|
BLAKE2b-256 checksum How to use checksums |
f20c8f8acf310719f0041003c6f93ab4c95bc783c6fc25c0d37726d8ff8d32d2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 Jan 28, 2026.
Transparency logRelease files / aionatgrid-0.4.0-py3-none-any.whl
| Download URL | aionatgrid-0.4.0-py3-none-any.whl |
|---|---|
| Size | 28.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
efcd353ac1935e56c8891ccd6047ea82ab769b910d1a1e10aca8bd66c91e6360
|
|
BLAKE2b-256 checksum How to use checksums |
5494ce8bab85562abf508c79004f29c4df8306efe02234541fbedf27f6d92ada
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 Jan 28, 2026.
Transparency logSecurity for aionatgrid 0.4.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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for aionatgrid-0.4.0.tar.gz
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 Jan 28, 2026.
Transparency logA 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.