(path: Optional[Path] = None)
| 25 | |
| 26 | |
| 27 | def 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 | |
| 42 | def get_existing_exp_id() -> Optional[str]: |
no outgoing calls
no test coverage detected
searching dependent graphs…