Skip to main content

Enedis data connect client

Project description

# Enedis data connect client

Enedis data connect client is a client for the REST API of the Enedis company.

The client is used to retrieve the consumption and production data, refer to the documentation provided by the Enedis API on https://datahub-enedis.fr/services-api/data-connect/documentation.

## Connecting the client to authenticate and get the token

To connect you need to provide at least one PRM identifier (for consumption and / or production) described in the contract.

You have to pass the client identifier and the secret key generated by the Enedis portal.

client = EnedisClient(pdl, id, secret) client.connect()

If the authentication fails, an InvalidAccess exception is thrown otherwise the token data will be stored internally.

## Closing or deleting token data

To clear the token data, you just have to use:

client.close()

## Other methods

The client has some getters to access counters and basic data.

client.get_consumption_prm()

client.get_production_prm()

client.get_client_id()

client.get_token_data()

client.get_requests_count()

client.get_errors_count()

client.is_connected()

## The helper

The module provides a helper class useful for retrieving data from the API.

To instantiate the helper, you just need to pass the client instance.

helper = EnedisApiHelper(client)

To use the helper, it is not necessary to authenticate first. The helper will manage the authentication process (with retry on token expiration)

### Get the maximum consumed power per day

The maximum consumed power per day is returned as a dictionary of integers indexed by the datetime. To request the API you have to pass a start date and the end date.

To request data of consumption you need to provide the PRM identifier for consumption when instantiating the client.

data: dict[datetime, int] = helper.get_max_daily_consumed_power(start_time, end_time)

### Get the consumption per day

The consumption per day is returned as a dictionary of integers indexed by the date. To request the API you have to pass a start date and the end date.

To request data of consumption you need to provide the PRM identifier for consumption when instantiating the client.

data: dict[date, int] = helper.get_daily_consumption(start_time, end_time)

### Get the consumption per half an hour

The consumption is returned as a dictionary of integers indexed by the datetime. To request the API you have to pass a start date and the end date.

To request data of consumption you need to provide the PRM identifier for consumption when instantiating the client.

data: dict[datetime, int] = helper.get_consumption_load_curve(start_time, end_time)

### Get the production per day

The production per day is returned as a dictionary of integers indexed by the date. To request the API you have to pass a start date and the end date.

To request data of production you need to provide the PRM identifier for production when instantiating the client.

data: dict[date, int] = helper.get_daily_production(start_time, end_time)

### Get the production per half an hour

The production is returned as a dictionary of integers indexed by the datetime. To request the API you have to pass a start date and the end date.

To request data of production you need to provide the PRM identifier for production when instantiating the client.

data: dict[datetime, int] = helper.get_production_load_curve(start_time, end_time)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

enedis_data_connect-1.1.0.tar.gz (25.2 kB view details)

Uploaded Source

Built Distribution

enedis_data_connect-1.1.0-py3-none-any.whl (21.3 kB view details)

Uploaded Python 3

File details

Details for the file enedis_data_connect-1.1.0.tar.gz.

File metadata

  • Download URL: enedis_data_connect-1.1.0.tar.gz
  • Upload date:
  • Size: 25.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.19

File hashes

Hashes for enedis_data_connect-1.1.0.tar.gz
Algorithm Hash digest
SHA256 8933179a5e2e1f2d5dba991504de4f95955cc6b111dd7e0516fd15c7ac63cb62
MD5 025254158a64fd15d9cddb8b292c1067
BLAKE2b-256 7d6d7858c81362a7b77aace5e7fb9b9a53a831bebb3920bf7f358dc8710898b4

See more details on using hashes here.

File details

Details for the file enedis_data_connect-1.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for enedis_data_connect-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 987ad894b6817c506ce0bf7bcc969c5dad30a594cc891c63aecbcfda7e4c4eb4
MD5 42a3ce3553596d142a870278f18801f0
BLAKE2b-256 06a9b6f0b39837427e79dd1175d8ce2ab502d5cc247947e2ade3b0dadabdf313

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page