MCPcopy Create free account
hub / github.com/mlco2/codecarbon / __init__

Method __init__

codecarbon/core/api_client.py:40–64  ·  view source on GitHub ↗

:endpoint_url: URL of the API endpoint :experiment_id: ID of the experiment :api_key: Code Carbon API_KEY :access_token: Code Carbon API access token :conf: Metadata of the experiment :create_run_automatically: If False, do not create a run. To use AP

(
        self,
        endpoint_url="https://api.codecarbon.io",
        experiment_id=None,
        api_key=None,
        access_token=None,
        conf=None,
        create_run_automatically=True,
    )

Source from the content-addressed store, hash-verified

38 run_id = None
39
40 def __init__(
41 self,
42 endpoint_url="https://api.codecarbon.io",
43 experiment_id=None,
44 api_key=None,
45 access_token=None,
46 conf=None,
47 create_run_automatically=True,
48 ):
49 """
50 :endpoint_url: URL of the API endpoint
51 :experiment_id: ID of the experiment
52 :api_key: Code Carbon API_KEY
53 :access_token: Code Carbon API access token
54 :conf: Metadata of the experiment
55 :create_run_automatically: If False, do not create a run. To use API in read only mode.
56 """
57 # super().__init__(base_url=endpoint_url) # (AsyncClient)
58 self.url = endpoint_url
59 self.experiment_id = experiment_id
60 self.api_key = api_key
61 self.conf = conf
62 self.access_token = access_token
63 if self.experiment_id is not None and create_run_automatically:
64 self._create_run(self.experiment_id)
65
66 def _get_headers(self):
67 headers = {"Content-Type": "application/json"}

Callers

nothing calls this directly

Calls 1

_create_runMethod · 0.95

Tested by

no test coverage detected