diff --git a/dwd_global_radiation/global_radiation.py b/dwd_global_radiation/global_radiation.py index 8e7ad66..eee3a24 100644 --- a/dwd_global_radiation/global_radiation.py +++ b/dwd_global_radiation/global_radiation.py @@ -125,8 +125,8 @@ def get_forecast_for_future_hour(self, datetime_input, number_of_hours): retrieve the forecast. Returns: - str: A JSON string containing the forecast timestamp in UTC and sis (Global Radiation) - value, or an error message if no forecast is found for the specified time. + dict: A dictionary containing the forecast timestamp in UTC and sis (Global Radiation) + value, or an error message if no forecast is found for the specified time. """ # Ensure datetime_input is in UTC datetime_input = datetime_input.astimezone(timezone.utc) @@ -145,16 +145,14 @@ def get_forecast_for_future_hour(self, datetime_input, number_of_hours): if target_index < len(self.forecasts[0].entries): forecast_entry = self.forecasts[0].entries[target_index] - return json.dumps( - { - "timestamp": datetime.fromtimestamp( - forecast_entry.timestamp, tz=timezone.utc - ).strftime("%Y-%m-%dT%H:%M:%S%z"), - "sis": round(forecast_entry.sis), - } - ) - - return json.dumps({"error": "No forecast found for the specified time"}) + return { + "timestamp": datetime.fromtimestamp( + forecast_entry.timestamp, tz=timezone.utc + ).strftime("%Y-%m-%dT%H:%M:%S%z"), + "sis": round(forecast_entry.sis), + } + + return {"error": "No forecast found for the specified time"} @dataclass diff --git a/setup.py b/setup.py index 7408dbe..7b7a8b1 100644 --- a/setup.py +++ b/setup.py @@ -15,7 +15,7 @@ setup( name='dwd_global_radiation', - version='1.1.0rc5', + version='1.1.0rc6', packages=find_packages(), description='Access and analyze DWD global radiation data and forecasts', long_description=long_description,