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

Function get_api_endpoint

codecarbon/cli/cli_utils.py:27–39  ·  view source on GitHub ↗
(path: Optional[Path] = None)

Source from the content-addressed store, hash-verified

25
26
27def get_api_endpoint(path: Optional[Path] = None):
28 p = path or Path.cwd().resolve() / ".codecarbon.config"
29 if p.exists():
30 config = configparser.ConfigParser()
31 config.read(str(p))
32 if "codecarbon" in config.sections():
33 d = dict(config["codecarbon"])
34 if "api_endpoint" in d:
35 return d["api_endpoint"]
36 else:
37 with p.open("a") as f:
38 f.write("api_endpoint=https://api.codecarbon.io\n")
39 return "https://api.codecarbon.io"
40
41
42def get_existing_exp_id() -> Optional[str]:

Callers 5

show_configFunction · 0.90
api_getFunction · 0.90
loginFunction · 0.90
get_api_keyFunction · 0.90
configFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…