aioengiebelgium
Unofficial asynchronous Python library to interact with the ENGIE Belgium API.
Requires Python >= 3.14.
Install
pip install aioengiebelgium
Usage
import asyncio
import json
from pathlib import Path
from aioengiebelgium import EngieBeClient, MfaMethod
_TOKEN_FILE = Path("tokens.json")
async def persist_tokens(access_token: str, refresh_token: str) -> None:
# Save the token pair for the next refresh.
payload = json.dumps({"access": access_token, "refresh": refresh_token})
await asyncio.to_thread(_TOKEN_FILE.write_text, payload)
async def first_login() -> None:
# First run: log in with MFA. on_token_refresh saves the tokens.
async with EngieBeClient(on_token_refresh=persist_tokens) as client:
flow = await client.async_start_authentication(
"user@example.com",
"password",
mfa_method=MfaMethod.SMS,
)
# Once you receive your MFA code, then:
await flow.async_submit_mfa("123456")
relations = await client.async_get_customer_account_relations()
print(relations)
async def next_run() -> None:
# Later runs: reuse the saved tokens and skip the login entirely.
raw = await asyncio.to_thread(_TOKEN_FILE.read_text)
tokens = json.loads(raw)
async with EngieBeClient(
access_token=tokens["access"],
refresh_token=tokens["refresh"],
on_token_refresh=persist_tokens,
) as client:
contracts = await client.async_get_energy_contracts("1234567890")
print(contracts)
if _TOKEN_FILE.exists():
asyncio.run(next_run())
else:
asyncio.run(first_login())
Development
This project uses uv and targets Python 3.14+.
uv sync
uv run python -m scripts.check
License
MIT, see LICENSE.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file aioengiebelgium-0.1.1.tar.gz.
File metadata
- Download URL: aioengiebelgium-0.1.1.tar.gz
- Upload date:
- Size: 26.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0612a092cda3c0275b0f3c63fbc53ccc4f6836d0addb76ef65e67a6d00c370dd
|
|
| MD5 |
099688b1aff290a545d4e2ab72a53e2c
|
|
| BLAKE2b-256 |
b6a4687693fe075535d2e04c0084f8f0f9c29dbab6eb880890a0fd6196c231d2
|
Provenance
The following attestation bundles were made for aioengiebelgium-0.1.1.tar.gz:
Publisher:
release.yml on DaanVervacke/aioengiebelgium
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
aioengiebelgium-0.1.1.tar.gz -
Subject digest:
0612a092cda3c0275b0f3c63fbc53ccc4f6836d0addb76ef65e67a6d00c370dd - Sigstore transparency entry: 2454262153
- Sigstore integration time:
-
Permalink:
DaanVervacke/aioengiebelgium@312f0a07134f295affe8c615ce7c9d28976bb067 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/DaanVervacke
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@312f0a07134f295affe8c615ce7c9d28976bb067 -
Trigger Event:
push
-
Statement type:
File details
Details for the file aioengiebelgium-0.1.1-py3-none-any.whl.
File metadata
- Download URL: aioengiebelgium-0.1.1-py3-none-any.whl
- Upload date:
- Size: 32.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
26f1098fb5a0b22969d1c5fd3d455caa957d8ffa426a47316b658783eb916794
|
|
| MD5 |
7bfeadbe98d2559113a5ed02cfc49b83
|
|
| BLAKE2b-256 |
9e3f3ec4eaa722d860fd5b431f985c7860cfe5192e703a813e05453b8e60c84b
|
Provenance
The following attestation bundles were made for aioengiebelgium-0.1.1-py3-none-any.whl:
Publisher:
release.yml on DaanVervacke/aioengiebelgium
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
aioengiebelgium-0.1.1-py3-none-any.whl -
Subject digest:
26f1098fb5a0b22969d1c5fd3d455caa957d8ffa426a47316b658783eb916794 - Sigstore transparency entry: 2454262332
- Sigstore integration time:
-
Permalink:
DaanVervacke/aioengiebelgium@312f0a07134f295affe8c615ce7c9d28976bb067 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/DaanVervacke
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@312f0a07134f295affe8c615ce7c9d28976bb067 -
Trigger Event:
push
-
Statement type: