diff --git a/sdk/rapid/rapid.py b/sdk/rapid/rapid.py index e2a560a..ef2c51b 100644 --- a/sdk/rapid/rapid.py +++ b/sdk/rapid/rapid.py @@ -4,6 +4,7 @@ from datetime import datetime from typing import Dict, Optional +from io import StringIO import pandas as pd @@ -139,12 +140,11 @@ def download_dataframe( data=json.dumps(query.dict(exclude_none=True)), timeout=TIMEOUT_PERIOD, ) - data = json.loads(response.content.decode("utf-8")) if response.status_code == 200: - return pd.read_json(json.dumps(data), orient="index") + return pd.read_json(StringIO(response.content.decode("utf-8")), orient="index") raise DatasetNotFoundException( - f"Could not find dataset, {layer}/{domain}/{dataset} to download", data + f"Could not find dataset, {layer}/{domain}/{dataset} to download", response.json() ) def upload_dataframe(