Official Python SDK for WattLayer — Korea's power-market & distributed-energy data API (The Stripe for Energy Data).
Project description
WattLayer Python SDK
Korea's power-market & distributed-energy data, one import away.
wattlayer is the official Python client for the WattLayer API —
real-time SMP (system marginal price), power supply/demand, weather, generation
facilities, distributed-energy special zones, and grid events, wrapped from Korea's
public data sources into one developer-friendly REST API.
Install
pip install wattlayer
Quickstart
from wattlayer import WattLayerClient
client = WattLayerClient(api_key="wl_live_...")
# Latest SMP
smp = client.smp.latest(country="kr", region="mainland")
print(f"{smp['price']} KRW/kWh @ {smp['timestamp']}")
# Current supply / demand / reserve margin
supply = client.supply.current(country="kr")
print(f"demand {supply['current_demand_mw']} MW, reserve {supply['reserve_rate']}%")
# Distributed-energy special zone (WattLayer-exclusive metadata)
jeju = client.zones.get("kr-jeju")
print(jeju["direct_ppa_allowed"], jeju["allowed_sources"])
Get a free key (10,000 calls/month, no credit card) at https://console.wattlayer.io/register.
Configuration
The key and base URL are read from the environment when not passed explicitly:
export WATTLAYER_API_KEY=wl_live_...
export WATTLAYER_API_URL=https://api.wattlayer.io # optional
client = WattLayerClient(timeout=10.0, max_retries=3)
Requests retry automatically (exponential backoff: 1s, 2s, 4s) on 429 and 5xx.
Use the client as a context manager to close its connection pool:
with WattLayerClient() as client:
print(client.meta.health())
Resources
| Namespace | Methods |
|---|---|
client.smp |
latest, history, stats |
client.supply |
current, today, history |
client.weather |
forecast, current — pass region="seoul" or nx=/ny= |
client.facilities |
list, get, stats |
client.zones |
list, get, facilities |
client.events |
list |
client.auth |
register, me, rotate |
client.meta |
health, status, licenses |
Every method returns the parsed data payload. Attribution/license metadata is
returned by the API in each response's meta block — see client.meta.licenses().
Errors
from wattlayer import WattLayerRateLimitError, WattLayerAuthError
try:
client.smp.latest()
except WattLayerRateLimitError as e:
print("quota hit, resets at", e.reset)
except WattLayerAuthError:
print("check your API key")
All exceptions derive from WattLayerError
(WattLayerConnectionError, WattLayerAPIError → WattLayerAuthError,
WattLayerNotFoundError, WattLayerRateLimitError).
License
MIT · Data sourced under KOGL Type 1 (attribution) from KPX & KMA via data.go.kr.
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 wattlayer-1.0.0.tar.gz.
File metadata
- Download URL: wattlayer-1.0.0.tar.gz
- Upload date:
- Size: 8.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
83b167b52f6ec5cc0d689f0a63d7afadf4cde01fe49b8c888a475efcfaf2557a
|
|
| MD5 |
14b9294bf82af18944252554a3f3b264
|
|
| BLAKE2b-256 |
2acf7107f5fa78539d7cafe91205ca31a05afe3d28281b07011bc6ea051a3e83
|
File details
Details for the file wattlayer-1.0.0-py3-none-any.whl.
File metadata
- Download URL: wattlayer-1.0.0-py3-none-any.whl
- Upload date:
- Size: 9.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d4a9b1a9e50613e4894925b2dbb9bc0138c1b53cc597d0ca4e37dceeb920bb91
|
|
| MD5 |
7e22191bea44abac3919e7dbcd6ca333
|
|
| BLAKE2b-256 |
0ec154db91d3f084260dad6ec55e4e3aa92eaaacc2d5be3be12b2bdf751492c6
|