From 8774757bb9035bd4f4181c7eb02c9287b7c75dec Mon Sep 17 00:00:00 2001 From: Peter Dudfield <34686298+peterdudfield@users.noreply.github.com> Date: Mon, 18 Nov 2024 09:46:10 +0000 Subject: [PATCH] print url when timeout occurs (#223) --- quartz_solar_forecast/weather/open_meteo.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/quartz_solar_forecast/weather/open_meteo.py b/quartz_solar_forecast/weather/open_meteo.py index f5082440..cc6b44f4 100644 --- a/quartz_solar_forecast/weather/open_meteo.py +++ b/quartz_solar_forecast/weather/open_meteo.py @@ -149,7 +149,11 @@ def get_hourly_weather( "terrestrial_radiation", ] url = self._build_url(latitude, longitude, start_date, end_date, variables) - response = requests.get(url) + try: + response = requests.get(url) + except requests.exceptions.Timeout: + + raise TimeoutError(f"Request to OpenMeteo API timed out. URl - {url}") data = response.json()["hourly"] df = pd.DataFrame(data)