Skip to main content

PyGazpar

PyGazpar is a Python library for getting natural gas consumption from GrDF French provider.

Their natural gas meter is called Gazpar. It is wireless and transmit the gas consumption once per day.

All consumption data is available on the client account at GrDF Web Site (https://monespace.grdf.fr).

PyGazpar automatically goes through the Web Site and download the consumption data, and make it available in a Python structure.

Installation

Requirements

PyGazpar does not require Selenium and corresponding geckodriver to work.

With the new GrDF web site, it is possible to load the consumption data far easily than before.

PyGazpar uses Poetry for dependency and package management.

Create your virtual environment

$ cd /path/to/my_project_folder/

$ poetry install

PyGazpar installation

Use the package manager pip to install PyGazpar.

pip install pygazpar

You can also download the source code and install it manually.

cd /path/to/pygazpar/

$ poetry install

Usage

Command line:

  1. Standard usage (using Json GrDF API).
$ pygazpar -u 'your login' -p 'your password' -c 'your PCE identifier' --datasource 'json'
  1. Alternate usage (using Excel GrDF document).
$ pygazpar -u 'your login' -p 'your password' -c 'your PCE identifier' -t 'temporary directory where to store Excel file (ex: /tmp)' --datasource 'excel'
  1. Test usage (using local static data files, do not connect to GrDF site).
$ pygazpar -u 'your login' -p 'your password' -c 'your PCE identifier' --datasource 'test'

Library:

  1. Standard usage (using Json GrDF API).
import pygazpar

client = pygazpar.Client(pygazpar.JsonWebDataSource(
    username='your login',
    password='your password')
)

# Returns the list of your PCE identifiers attached to your account.
pce_identifiers = client.get_pce_identifiers()

# Returns the daily and monthly consumptions for the last 60 days on your PCE identifier.
data = client.load_since(pce_identifier='your PCE identifier',
                        last_n_days=60,
                        frequencies=[pygazpar.Frequency.DAILY, pygazpar.Frequency.MONTHLY])

See samples/jsonSample.py file for the full example.

  1. Alternate usage (using Excel GrDF document).
import pygazpar

client = pygazpar.Client(pygazpar.ExcelWebDataSource(
    username='your login',
    password='your password')
)

# Returns the list of your PCE identifiers attached to your account.
pce_identifiers = client.get_pce_identifiers()

# Returns the daily and monthly consumptions for the last 60 days on your PCE identifier.
data = client.load_since(pce_identifier='your PCE identifier',
                        last_n_days=60,
                        frequencies=[pygazpar.Frequency.DAILY, pygazpar.Frequency.MONTHLY])

See samples/excelSample.py file for the full example.

  1. Test usage (using local static data files, do not connect to GrDF site).
import pygazpar

client = pygazpar.Client(pygazpar.TestDataSource())

data = client.load_since(pce_identifier='your PCE identifier',
                        last_n_days=10,
                        frequencies=[pygazpar.Frequency.DAILY, Frequency.MONTHLY])

See samples/testSample.py file for the full example.

Output:

data =>
{
  "daily": [
    {
      "time_period": "13/10/2022",
      "start_index_m3": 15724,
      "end_index_m3": 15725,
      "volume_m3": 2,
      "energy_kwh": 17,
      "converter_factor_kwh/m3": 11.16,
      "temperature_degC": null,
      "type": "Mesur\u00e9",
      "timestamp": "2022-12-13T23:58:35.606763"
    },
    ...
    {
      "time_period": "11/12/2022",
      "start_index_m3": 16081,
      "end_index_m3": 16098,
      "volume_m3": 18,
      "energy_kwh": 201,
      "converter_factor_kwh/m3": 11.27,
      "temperature_degC": -1.47,
      "type": "Mesur\u00e9",
      "timestamp": "2022-12-13T23:58:35.606763"
    }
  ],
  "monthly": [
    {
      "time_period": "Novembre 2022",
      "start_index_m3": 15750,
      "end_index_m3": 15950,
      "volume_m3": 204,
      "energy_kwh": 2227,
      "timestamp": "2022-12-13T23:58:35.606763"
    },
    {
      "time_period": "D\u00e9cembre 2022",
      "start_index_m3": 15950,
      "end_index_m3": 16098,
      "volume_m3": 148,
      "energy_kwh": 1664,
      "timestamp": "2022-12-13T23:58:35.606763"
    }
  ]
}

Limitation

PyGazpar relies on how GrDF Web Site is built.

Any change in the Web site may break this library.

We expect in close Future that GrDF makes available an open API from which we can get safely their data.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT

Project status

PyGazpar has been initiated for integration with Home Assistant.

Corresponding Home Assistant integration custom component is available here.

Metadata

Release files for pygazpar 1.3.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 pygazpar 1.3.1
File Size Uploaded Provenance
pygazpar-1.3.1.tar.gz 31.3 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for pygazpar 1.3.1
File Interpreter ABI Platform
pygazpar-1.3.1-py3-none-any.whl Python 3 none any Details

Total release size: 61.6 kB

Release files / pygazpar-1.3.1.tar.gz

Download URL pygazpar-1.3.1.tar.gz
Size 31.3 kB
Tags Source
SHA-256 checksum
How to use checksums
5f31baa9eb3655d1e988bd93718c49be255267c3a07d28b089123a5d4762b444
BLAKE2b-256 checksum
How to use checksums
05e48c9b5c1413d991c72ab628f90541036aa79e723f9de756977c82e57aec10
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

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 Jul 22, 2025.

Transparency log

Release files / pygazpar-1.3.1-py3-none-any.whl

Download URL pygazpar-1.3.1-py3-none-any.whl
Size 30.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c4cbe27bc3596e4f02f79bb0a00acfb5e33a9cc158abab4c968e0869c44cab1d
BLAKE2b-256 checksum
How to use checksums
84aac6fdf99617b558160693904a7c0ccbd2086ea03faf6e8d96f28fea60b9c4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

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 Jul 22, 2025.

Transparency log

Security for pygazpar 1.3.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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for pygazpar-1.3.1.tar.gz

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 Jul 22, 2025.

Transparency log

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.

Release history Release notifications | RSS feed

This release

1.3.1 This release

2 release files Full provenance

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