From 4756457f426bb40b6f967a796ab6958113c0a6c5 Mon Sep 17 00:00:00 2001 From: Gert Mertes Date: Wed, 17 Jul 2024 14:38:45 +0000 Subject: [PATCH] API update --- src/anemoi/training/diagnostics/mlflow/auth.py | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/anemoi/training/diagnostics/mlflow/auth.py b/src/anemoi/training/diagnostics/mlflow/auth.py index bcf7248c..5cfe0f72 100644 --- a/src/anemoi/training/diagnostics/mlflow/auth.py +++ b/src/anemoi/training/diagnostics/mlflow/auth.py @@ -5,7 +5,6 @@ # granted to it by virtue of its status as an intergovernmental organisation # nor does it submit to any jurisdiction. -import json import os import time from datetime import datetime @@ -194,13 +193,7 @@ def _request(self, path, payload): response_json = response.json() if response_json.get("status", "") != "OK": - # TODO: there's a bug in the API that returns the error response as a string instead of a json object. - # Remove this when the API is fixed. - if isinstance(response_json["response"], str): - error = json.loads(response_json["response"]) - else: - error = response_json["response"] - error_description = error.get("error_description", "Error acquiring token.") + error_description = response_json.get("response", "Error acquiring token.") raise RuntimeError(error_description) return response_json["response"]