(self, total: EmissionsData, _: EmissionsData)
| 20 | self.endpoint_url: str = endpoint_url |
| 21 | |
| 22 | def out(self, total: EmissionsData, _: EmissionsData): |
| 23 | try: |
| 24 | payload = dataclasses.asdict(total) |
| 25 | payload["user"] = getpass.getuser() |
| 26 | resp = requests.post(self.endpoint_url, json=payload, timeout=10) |
| 27 | if resp.status_code != 201: |
| 28 | logger.warning( |
| 29 | "HTTP Output returned an unexpected status code: ", |
| 30 | resp, |
| 31 | ) |
| 32 | except Exception as e: |
| 33 | logger.error(e, exc_info=True) |
| 34 | |
| 35 | |
| 36 | class CodeCarbonAPIOutput(BaseOutput): |
nothing calls this directly
no outgoing calls
no test coverage detected