Python interface for the EnergyID API
Project description
energyid-py
Async Python client for the EnergyID API.
Installation
pip install EnergyID
Quick Start
import asyncio
from energyid import JSONClient
async def main():
async with JSONClient(api_key="YOUR_API_KEY") as client:
member = await client.get_member()
records = await client.get_member_records()
meters = await client.get_record_meters(records[0].id)
readings = await client.get_meter_readings(meters[0].id, take=10)
print(member["fullName"], len(readings["readings"]))
asyncio.run(main())
Authentication
from energyid import JSONClient
# API Key (recommended)
client = JSONClient(api_key="YOUR_API_KEY")
# Device Token
client = JSONClient(device_token="YOUR_DEVICE_TOKEN")
# OAuth2
client = JSONClient(
client_id="ID",
client_secret="SECRET",
username="user@example.com",
password="pass",
)
Built-in Request Throttling
JSONClient includes two safeguards to reduce backend pressure:
max_concurrency: max in-flight HTTP requests.max_requests_per_window+rate_limit_window_seconds: request-rate cap.
Defaults are conservative (max_concurrency=10, max_requests_per_window=20, rate_limit_window_seconds=1.0).
client = JSONClient(
api_key="YOUR_API_KEY",
max_concurrency=5,
max_requests_per_window=10,
rate_limit_window_seconds=1.0,
)
Set max_concurrency=None and/or max_requests_per_window=None to disable a limiter.
PandasClient
Use PandasClient for DataFrame/Series output:
import asyncio
from energyid import PandasClient
async def main():
async with PandasClient(api_key="YOUR_API_KEY") as client:
df = await client.get_meter_readings(meter_id="meter-id", take=100)
ts = await client.get_record_data(
record_id=123,
name="electricityImport",
start="2024-01-01",
end="2024-12-31",
interval="month",
)
print(df.shape, ts.shape)
asyncio.run(main())
API Documentation
License
MIT
Project details
Release history Release notifications | RSS feed
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 energyid-1.0.0.tar.gz.
File metadata
- Download URL: energyid-1.0.0.tar.gz
- Upload date:
- Size: 157.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0763cd80f3bc3e5144023d17f3cf096622b8770f80235294858ab91747a46707
|
|
| MD5 |
cd27e996c7af737afbcd19669a4e57b3
|
|
| BLAKE2b-256 |
f012704d461473e8121eccf14c25190697dd02ade1b0aa103be44ee7a74dda6d
|
File details
Details for the file energyid-1.0.0-py3-none-any.whl.
File metadata
- Download URL: energyid-1.0.0-py3-none-any.whl
- Upload date:
- Size: 18.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
baa6d483a535eb87f392903329beb6f1e1bb9cb40382c4c66ffaa2554aff4515
|
|
| MD5 |
79b40b72c07e06b33a88e317f3917d74
|
|
| BLAKE2b-256 |
28a4ad254f1b973b1300cb4836ddf45cc231845ff4e96eef3bda6e26b584baf9
|