carbonai.PowerMeter.from_config

classmethod PowerMeter.from_config(path)

Create a PowerMeter from a json config file.

The json config file may contain any key named after the arguments of the carbonai.PowerMeter constructor.

Parameters
pathstr

Path to the json config file

Returns
PowerMeter

See also

PowerMeter

Instantiate a PowerMeter by declaring every argument

Examples

Example of config file used. This file is named config.json

{
    "project_name": "Project X",
    "program_name": "Program X",
    "client_name": "Client X",
    "get_country": true,
    "is_online": false,
    "user_name": "customUsername",
    "filepath": "",
    "api_endpoint": "...",
    "location":"FR"
}

To load this file as a power meter.

>>> power_meter = PowerMeter.from_config("config.json")