
Security News
Crates.io Users Targeted by Phishing Emails
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Asynchronous Python client for the EnergyZero API.
A python package with which you can retrieve the dynamic energy/gas prices from EnergyZero and can therefore also be used for third parties who purchase their energy via EnergyZero, such as:
pip install energyzero
import asyncio
from datetime import date
from energyzero import EnergyZero
async def main() -> None:
"""Show example on fetching the energy prices from EnergyZero."""
async with EnergyZero() as client:
start_date = date(2022, 12, 7)
end_date = date(2022, 12, 7)
energy = await client.get_electricity_prices(start_date, end_date)
gas = await client.get_gas_prices(start_date, end_date)
if __name__ == "__main__":
asyncio.run(main())
More examples can be found in the examples folder.
Note: Currently tested primarily with day-ahead pricing (today/tomorrow).
You can retrieve both electricity and gas pricing data using this package. Each data type supports a set of common fields, with some additional properties depending on whether you use the GraphQL or legacy REST endpoint.
Electricity prices change every hour. Prices for the next day are typically published between 14:00–15:00.
Electricity
and EnergyPrices
)current_price
— Current electricity price for the current hour or time rangeaverage_price
— Average price over the selected periodextreme_prices
— Tuple of (min_price, max_price)
pct_of_max_price
— Current price as a percentage of the maximumprice_at_time(moment)
— Get price for a specific datetime
timestamp_prices
— List of hourly price entries:
{"timestamp": datetime, "price": float}
{"timerange": TimeRange, "price": float}
get_electricity_prices()
)highest_price_time_range
— TimeRange
where the price is highestlowest_price_time_range
— TimeRange
where the price is lowesttime_ranges_priced_equal_or_lower
— Count of hours where the price is less than or equal to the currentget_electricity_prices_legacy()
)highest_price_time
— Timestamp of the highest hourly pricelowest_price_time
— Timestamp of the lowest hourly pricehours_priced_equal_or_lower
— Count of hours with a price ≤ current priceGas prices are fixed for 24 hours, and a new daily rate applies starting at 06:00 each morning.
Gas
and EnergyPrices
)current_price
— Current gas price for todayaverage_price
— Average gas price over the selected periodextreme_prices
— Tuple of (min_price, max_price)
price_at_time(moment)
— Get price for a specific datetime
timestamp_prices
— List of daily price entries:
{"timestamp": datetime, "price": float}
{"timerange": TimeRange, "price": float}
get_gas_prices()
)highest_price_time_range
— Time range with the highest daily pricelowest_price_time_range
— Time range with the lowest daily pricepct_of_max_price
— Current price as a percentage of the maximumtime_ranges_priced_equal_or_lower
— Count of days with a price ≤ current priceget_electricity_prices()
Parameter | Type | Description |
---|---|---|
start_date | date | Start of the period (local timezone). |
end_date | date | End of the period (local timezone). |
price_type | PriceType | Type of price to return: ALL_IN or MARKET . |
get_gas_prices()
Parameter | Type | Description |
---|---|---|
start_date | date | Start of the period (local timezone). |
end_date | date | End of the period (local timezone). |
price_type | PriceType | Type of price to return: ALL_IN or MARKET . |
get_electricity_prices_legacy()
Parameter | Type | Description |
---|---|---|
start_date | date | Start of the period (local timezone). |
end_date | date | End of the period (local timezone). |
interval | Interval | Data interval (see Interval enum values). |
vat | VatOption | None | VAT inclusion (included by default). |
get_gas_prices_legacy()
Parameter | Type | Description |
---|---|---|
start_date | date | Start of the period (local timezone). |
end_date | date | End of the period (local timezone). |
interval | Interval | Data interval (see Interval enum values). |
vat | VatOption | None | VAT inclusion (included by default). |
VatOption
Defines whether prices returned by legacy methods should include VAT.
Value | Description |
---|---|
INCLUDE | Return prices including VAT |
EXCLUDE | Return prices excluding VAT |
Used in: get_electricity_prices_legacy
, get_gas_prices_legacy
📝 Ignored in GraphQL methods (
get_electricity_prices
,get_gas_prices
)
PriceType
Specifies the type of prices returned by GraphQL methods.
Value | Description |
---|---|
MARKET | Raw wholesale market price (excludes tax, VAT, and purchasing costs) |
ALL_IN | Final consumer price (includes energy tax, VAT, and purchase fees) |
Used in: get_electricity_prices
, get_gas_prices
Interval
Specifies the interval for prices returned by the legacy methods.
Value | Description |
---|---|
DAY = 4 | Daily prices |
MONTH = 5 | Monthly prices |
YEAR = 6 | Yearly prices |
WEEK = 9 | Weekly prices |
Used in: get_electricity_prices_legacy
, get_gas_prices_legacy
This is an active open-source project. We are always open to people who want to use the code or contribute to it.
We've set up a separate document for our contribution guidelines.
Thank you for being involved! :heart_eyes:
The simplest way to begin is by utilizing the Dev Container feature of Visual Studio Code or by opening a CodeSpace directly on GitHub. By clicking the button below you immediately start a Dev Container in Visual Studio Code.
This Python project relies on Poetry as its dependency manager, providing comprehensive management and control over project dependencies.
You need at least:
Install all packages, including all development requirements:
poetry install
Poetry creates by default an virtual environment where it installs all necessary pip packages.
This repository uses the pre-commit framework, all changes are linted and tested with each commit. To setup the pre-commit check, run:
poetry run pre-commit install
And to run all checks and tests manually, use the following command:
poetry run pre-commit run --all-files
It uses pytest as the test framework. To run the tests:
poetry run pytest
To update the syrupy snapshot tests:
poetry run pytest --snapshot-update
MIT License
Copyright (c) 2022-2025 Klaas Schoute
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
FAQs
Asynchronous Python client providing energy/gas prices from EnergyZero
We found that energyzero demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Product
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.