From d1affa80fc8983896487636b4aa2bbd074edce8d Mon Sep 17 00:00:00 2001 From: Emily Price Date: Thu, 28 Nov 2024 12:01:29 +0000 Subject: [PATCH] Fix request url for twice-daily forecast --- CHANGELOG.md | 2 ++ src/datapoint/Manager.py | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8fcbc01..00a739b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [Unreleased] ++ Fix bug in API request when twice-daily forecast was used. + ## [0.12.0] - 2024-11-27 + Use one timestep per day for daily forecasts. diff --git a/src/datapoint/Manager.py b/src/datapoint/Manager.py index a1665fe..576302e 100644 --- a/src/datapoint/Manager.py +++ b/src/datapoint/Manager.py @@ -178,7 +178,11 @@ def __call_api(self, latitude, longitude, frequency): "accept": "application/json", "apikey": self.api_key, } - request_url = API_URL + frequency + + if frequency == "twice-daily": + request_url = API_URL + "daily" + else: + request_url = API_URL + frequency # Add a timeout to the request. # The value of 1 second is based on attempting 100 connections to