mlco2/codecarbon

API client to throw error instead of None

Geschlossen

#820 geöffnet am 13.04.2025

 (6 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)Python (306 Forks)auto 404
enhancementgood first issue

Repository-Metriken

Stars
 (1.885 Sterne)
PR-Merge-Metriken
 (PR-Metriken ausstehend)

Beschreibung

The Api client should raise_for_status() instead of None if there is an error. Like this we can call the API client and give a more meaningful error to the user.

Things to consider:

  • The API client should throw but the emissionsTracker should not break, this means that we should try-catch in the emissions tracker.
  • One should check as well if in any of the responses we are if response is None because now they will throw the error

Originally posted by @inimaz in https://github.com/mlco2/codecarbon/issues/798#issuecomment-2800035595

Contributor Guide