ENLYZE Client
- class enlyze.client.EnlyzeClient(token, *, _base_url=None)[source]
Main entrypoint for interacting with the ENLYZE platform.
You should instantiate it only once and use it for all requests to make the best use of connection pooling. This client is thread-safe.
- Parameters:
token (str) – API token for the ENLYZE platform
- get_sites()[source]
Retrieve all sites of your organization.
- Returns:
Sites of your organization
- Return type:
list[
Site]- Raises:
InvalidTokenErroron authentication failure- Raises:
EnlyzeErroron general failure
- get_machines(site=None)[source]
Retrieve all machines, optionally filtered by site.
- Parameters:
site (Site | None) – Only get machines of this site. Gets all machines of the organization if None.
- Returns:
Machines
- Return type:
list[
Machine]- Raises:
InvalidTokenErroron authentication failure- Raises:
EnlyzeErroron general failure
- get_variables(machine)[source]
Retrieve all variables of a machine.
- Parameters:
machine (Machine) – The machine for which to get all variables.
- Returns:
Variables of
machine- Raises:
InvalidTokenErroron authentication failure- Raises:
EnlyzeErroron general failure- Return type:
- get_products()[source]
Retrieve all products.
- Returns:
All products
- Raises:
InvalidTokenErroron authentication failure- Raises:
EnlyzeErroron general failure- Return type:
- get_timeseries(start, end, variables)[source]
Get timeseries data of variables for a given time frame.
Timeseries data for multiple variables can be requested at once. However, all variables must belong to the same machine.
You should always pass timezone-aware datetime objects to this method! If you don’t, naive datetime objects will be assumed to be expressed in the local timezone of the system where the code is run.
- Parameters:
- Returns:
Timeseries data or
Noneif the API returned no data for the request- Raises:
InvalidTokenErroron authentication failure- Raises:
EnlyzeErroron general failure- Return type:
TimeseriesData | None
- get_timeseries_with_resampling(start, end, variables, resampling_interval)[source]
Get resampled timeseries data of variables for a given time frame.
Timeseries data for multiple variables can be requested at once. However, all variables must belong to the same machine.
You should always pass timezone-aware datetime objects to this method! If you don’t, naive datetime objects will be assumed to be expressed in the local timezone of the system where the code is run.
- Parameters:
start (datetime) – Start of the time frame for which to fetch timeseries data. Must not be before
end.end (datetime) – End of the time frame for which to fetch timeseries data.
variables (Mapping[Variable, ResamplingMethod]) – The variables for which to fetch timeseries data along with a
ResamplingMethodfor each variable. Resampling isn’t supported for variables whoseVariableDataTypeis one of the ARRAY data types.resampling_interval (int) – The interval in seconds to resample timeseries data with. Must be greater than or equal
MINIMUM_RESAMPLING_INTERVAL.
- Returns:
Timeseries data or
Noneif the API returned no data for the request- Raises:
InvalidTokenErroron authentication failure- Raises:
ResamplingValidationErroron resampling validation error- Raises:
EnlyzeErroron general failure- Return type:
TimeseriesData | None
- get_production_runs(*, production_order=None, product=None, machine=None, start=None, end=None)[source]
Retrieve optionally filtered list of production runs.
- Parameters:
- Returns:
Production runs
- Return type:
- Raises:
InvalidTokenErroron authentication failure- Raises:
EnlyzeErroron general failure