Skip to main content

carbonintensity

PyPi version BuyMeCoffee

Simple Carbon Intensity UK API Library

The purpose of this library is to retrieve information from Carbon Intensity UK

The client connects asynchrnously to the API for retrieving information about the current level of CO2 generating energy in the current period.

It uses aiohttp to communicate with the API asynchrnously. This decision has been based mainly on the premise that the library will be used in the context of Home Assistant integration.

In addition it calculates when is the next 24 hours lowest level comparing values of the CO2 forecast levels.

Example

Retrieve regional and national information based on postcode SW1 for the next 24 hours starting now:

   client = Client("SW1")
   response = await client.async_get_data()
   data = response["data"]

Note: Time in UTC

Data format

An example of the function output can be found below:

   {
       "data":
        {
              "current_period_from": "2020-05-20T10:00+00:00",
              "current_period_to": "2020-05-20T10:30+00:00",
              "current_period_forecast":300,
              "current_period_index": "high",
              "current_period_national_forecast":230,
              "current_period_national_index": "moderate",
              "lowest_period_from":"2020-05-21T14:00+00:00",
              "lowest_period_to":"2020-05-21T14:30+00:00",
              "lowest_period_forecast": 168,
              "lowest_period_index": "moderate",
              "postcode": "SW1"
        }
    }

Install carbonintensity

python3 -m pip install -U carbonintensity

Licenses

This work is based on the following:

Metadata

Release files for carbon-intensity-uk 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for carbon-intensity-uk 1.0.1
File Size Uploaded Provenance Actions
carbon_intensity_uk-1.0.1.tar.gz 20.0 kB Without provenance Details for carbon_intensity_uk-1.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for carbon-intensity-uk 1.0.1
File Interpreter ABI Platform Actions
carbon_intensity_uk-1.0.1-py3-none-any.whl Python 3 none any Details for carbon_intensity_uk-1.0.1-py3-none-any.whl

Total release size: 27.6 kB

Release files / carbon_intensity_uk-1.0.1.tar.gz

Download URL carbon_intensity_uk-1.0.1.tar.gz
Size 20.0 kB
Tags Source
SHA-256 checksum
How to use checksums
9eca391e6d93ca7215889de720402c7d5b67668bd53f517097333a86774f036d
BLAKE2b-256 checksum
How to use checksums
7685e661f2bfd13e0dfb375f2ebeca8cf2687700d0d63111aad13c0cd04d388a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.5

Release files / carbon_intensity_uk-1.0.1-py3-none-any.whl

Download URL carbon_intensity_uk-1.0.1-py3-none-any.whl
Size 7.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bdf2ea44b4ec3f86eaea1077dda4efcdb83a293a8c488bee92ec6af7f21f08c6
BLAKE2b-256 checksum
How to use checksums
53cad6d9e1e799d368bf2ffbda5ae7aef51200dc80eae3b848054062466afd63
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.5

Security for carbon-intensity-uk 1.0.1

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page