File: prices_list.py

package info (click to toggle)
python-easyenergy 2.1.2-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 852 kB
  • sloc: python: 772; makefile: 5
file content (29 lines) | stat: -rw-r--r-- 814 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
"""Asynchronous Python client for the easyEnergy API."""

import asyncio
from datetime import date

from easyenergy import EasyEnergy, VatOption


async def main() -> None:
    """Show example on fetching the timestamp lists from easyEnergy."""
    async with EasyEnergy(vat=VatOption.INCLUDE) as client:
        today = date(2024, 1, 30)
        energy = await client.energy_prices(start_date=today, end_date=today)
        gas = await client.gas_prices(start_date=today, end_date=today)

        print("--- ENERGY / Usage ---")
        print(energy.timestamp_usage_prices)
        print()

        print("--- ENERGY / Return ---")
        print(energy.timestamp_return_prices)
        print()

        print("--- GAS ---")
        print(gas.timestamp_prices)


if __name__ == "__main__":
    asyncio.run(main())