aioukcarbon
Async Python client for the UK Carbon Intensity API.
Data provided by National Energy System Operator (NESO) via the Carbon Intensity API.
Installation
pip install aioukcarbon
Usage
import asyncio
from aioukcarbon import CarbonIntensityClient
async def main():
async with CarbonIntensityClient() as client:
# Regional intensity by postcode
regional = await client.get_regional_intensity("DE45")
print(f"Region: {regional.shortname}")
print(f"Forecast: {regional.periods[0].intensity.forecast} gCO2eq/kWh")
print(f"Index: {regional.periods[0].intensity.index}")
# National intensity
national = await client.get_national_intensity()
print(f"National: {national.intensity.forecast} gCO2eq/kWh")
# Generation mix
mix = await client.get_generation_mix()
for fuel in mix.generationmix:
print(f" {fuel.fuel}: {fuel.perc}%")
# 24h regional forecast
forecast = await client.get_regional_forecast("DE45")
for period in forecast.periods:
print(f" {period.from_time}: {period.intensity.forecast} gCO2eq/kWh")
asyncio.run(main())
API Reference
CarbonIntensityClient
get_regional_intensity(postcode)- Current regional carbon intensityget_regional_forecast(postcode, hours=24)- Regional forecast (24h or 48h)get_national_intensity()- Current national carbon intensityget_generation_mix()- Current national generation mix
Exceptions
CarbonIntensityError- Base exceptionCarbonIntensityConnectionError- Connection failuresCarbonIntensityTimeoutError- Request timeoutsCarbonIntensityNoDataError- No data available for postcode
License
MIT
Metadata
Release files for aioukcarbon 0.2.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 | |
|---|---|---|---|
| aioukcarbon-0.2.0.tar.gz | 7.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| aioukcarbon-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 13.6 kB
Release files / aioukcarbon-0.2.0.tar.gz
| Download URL | aioukcarbon-0.2.0.tar.gz |
|---|---|
| Size | 7.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
71019584e5daaad0d0e5d0f911a129aa9f90a0b92a5eab00c24411aede882211
|
|
BLAKE2b-256 checksum How to use checksums |
dd28f69d4ab773953ce19821a434cfa73779c6a0ba7e984aff18f4ed03ba2c61
|
| 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 Mar 5, 2026.
Transparency logRelease files / aioukcarbon-0.2.0-py3-none-any.whl
| Download URL | aioukcarbon-0.2.0-py3-none-any.whl |
|---|---|
| Size | 6.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
92d846db68703616ee731a83730452e4b3f739c176f5ee893b2294e263a3f813
|
|
BLAKE2b-256 checksum How to use checksums |
7a645a22e7b6460874aba030c670cdb93bd9f1b91cb049c14365e83f9641439e
|
| 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 Mar 5, 2026.
Transparency log