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 hashes)

Uploaded Source

Built Distribution

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

Uploaded Python 3

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