tetienne / python-veolia-api

Async Python wrapper to interact with internal Veolia API
MIT License
4 stars 3 forks source link

Small client to retrieve the water consumption from Veolia website: https://www.eau-services.com

Remarks

Veolia publishes water consumption with a delay of 3 days. It means if we are the 14, you will be only able to retrieve your data from the 11. To retrieve the hourly water consumption, you have to update your preferences on this page.

Installation

pip install pyolia

Getting started

import asyncio
from datetime import datetime, timedelta

from pyolia.client import VeoliaClient

USERNAME = "your username"
PASSWORD = "your password"

async def main() -> None:
    async with VeoliaClient(USERNAME, PASSWORD) as client:
        now = datetime.now()
        if now.day < 4:
            now = now - timedelta(days=3)
        consumption = await client.get_consumption(now.month, now.year)
        print(consumption)
        now = now - timedelta(days=3)
        consumption = await client.get_consumption(now.month, now.year, now.day)
        print(consumption)

asyncio.run(main())

Development

Installation

PyCharm

As IDE you can use PyCharm.

Using snap, run snap install pycharm --classic to install it.

For MacOS, run brew cask install pycharm-ce

Once launched, don't create a new project, but open an existing one and select the python-veolia-api folder.

Go to File | Settings | Project: nre-tag | Project Interpreter. Your interpreter must look like <whatever>/python-veolia-api/.venv/bin/python