Skip to main content

Async Python client for the Veolia water portal API (eau.veolia.fr).

Table of contents

Installation

First of all, you need to install devbox if you don't have a python environment

Once the previous step is done, simply run

devbox shell
cp .env.example .env   # fill in your credentials
python usage_example.py

That's it !

If you already have a python environment just run

pip install veolia-api-foxace

Usage

"""Example of usage of the Veolia API"""

import asyncio
from datetime import date

import aiohttp

from veolia_api.veolia_api import VeoliaAPI


async def main() -> None:
    """Main function."""

    async with aiohttp.ClientSession() as session:
        client_api = VeoliaAPI("your@email.com", "password", session)

        await client_api.fetch_all_data(date(2025, 1, 1), date(2025, 9, 1))

        # Display fetched data
        print(client_api.account_data.daily_consumption)
        print(client_api.account_data.monthly_consumption)
        print(client_api.account_data.alert_settings.daily_enabled)


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

You can use usage_example.py

Portals

Veolia operates several portals. They share the same Cognito authentication flow but each has its own client_id, and some run on a dedicated data backend. Select a portal with the portal_url argument (defaults to the national portal):

client_api = VeoliaAPI("your@email.com", "password", session, portal_url="www.ea-pm.fr")
portal_url Description Backend
eau.veolia.fr (default) Veolia France (national) default
eaudetm.monespace.eau.veolia.fr Eau de Toulouse Métropole default
www.ea-pm.fr Eau de Perpignan Méditerranée Métropole dedicated

You can resolve a commune name to its portal at setup time:

from veolia_api import resolve_portal_url

portal = await resolve_portal_url("Toulouse")   # "eaudetm.monespace.eau.veolia.fr"
client_api = VeoliaAPI("your@email.com", "password", session, portal_url=portal)

To add a portal, add an entry to VEOLIA_PORTALS in veolia_api/portals.py with its client_id (found in the portal's JavaScript bundle as ClientId:"...") and, if different from the default, its backend_url.

Refresh-token authentication

Some portals put password sign-ins behind Cognito's adaptive authentication: whenever it does not recognise the caller's context, Cognito answers a challenge (SMS_MFA in practice) instead of tokens. On accounts migrated to such a portal the pool's phone_number is an unverified placeholder, so the code never arrives and the challenge can never be answered. The client reports that case as VeoliaAPIChallengeError rather than a generic authentication failure.

REFRESH_TOKEN_AUTH is not a sign-in flow, so Cognito never risk-scores it: a refresh token obtained once from a context it already trusts authenticates from any address. Pass it instead of the credentials, which may then be empty:

client_api = VeoliaAPI("", "", session, refresh_token="ey...")

Obtain the token from a machine the portal is used from, with an InitiateAuth call carrying the portal's client_id:

curl -s https://cognito-idp.eu-west-3.amazonaws.com/ \
  -H 'Content-Type: application/x-amz-json-1.1' \
  -H 'X-Amz-Target: AWSCognitoIdentityProviderService.InitiateAuth' \
  -d '{"ClientId":"<client_id>","AuthFlow":"USER_PASSWORD_AUTH",
       "AuthParameters":{"USERNAME":"your@email.com","PASSWORD":"..."}}' \
  | python3 -c 'import json,sys; print(json.load(sys.stdin)["AuthenticationResult"]["RefreshToken"])'

A refresh token is a credential in its own right: store it as you would the password, and keep it out of logs and diagnostics.

Maintainers can regenerate the portal table from Veolia's national bundle:

python scripts/regenerate_portals.py

The script prints a candidate VEOLIA_PORTALS block and a diff against the current table — review and edit veolia_api/portals.py manually.

Contributing

Contributions are welcome. Please read CONTRIBUTING.md for guidelines on reporting bugs, suggesting features, and submitting pull requests.

Credits

This repository is inspired by the work done by @CorentinGrard. Thanks to him for his work. It is a fork of Jezza34000/veolia-api.

License

This project is licensed under the MIT License. See LICENSE for details.

Release files for veolia-api-foxace 2.5.0

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

Source distribution (sdist)

Source distribution for veolia-api-foxace 2.5.0
File Size Uploaded
veolia_api_foxace-2.5.0.tar.gz 20.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for veolia-api-foxace 2.5.0
File Interpreter ABI Platform
veolia_api_foxace-2.5.0-py3-none-any.whl Python 3 none any Details

Total release size: 40.0 kB

Release files / veolia_api_foxace-2.5.0.tar.gz

Download URL veolia_api_foxace-2.5.0.tar.gz
Size 20.2 kB
Tags Source
SHA-256 checksum
How to use checksums
b3f6b5148b3cabd4ca028fd10d6bc8c008be0e700f6bfde58e055df74a69b57a
BLAKE2b-256 checksum
How to use checksums
cfa7b08eedf7dc7c7c27493f6e1055b0100f68867c0f01431f768e1f77513578
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 3, 2026.

Transparency log

Release files / veolia_api_foxace-2.5.0-py3-none-any.whl

Download URL veolia_api_foxace-2.5.0-py3-none-any.whl
Size 19.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
342ca2bfe150b3213931d3dd85de0a841b46c35744264157ddeee0752368df72
BLAKE2b-256 checksum
How to use checksums
c5dd5f05786fe0edde8c27c852b6bda1395e217d44107b57f6dd416bf4a4dba6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 3, 2026.

Transparency log

Release history Release notifications | RSS feed

2.6.0

2 release files

2.5.1

2 release files

This release

2.5.0 This release

2 release files

2.4.4

2 release files

2.4.3

2 release files

2.4.2

2 release files

2.4.1

2 release files

2.4.0

2 release files

2.3.0

2 release files

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