From db2f98e63a06d8153d5adcc3e2f9fda353eeab1a Mon Sep 17 00:00:00 2001 From: evdo Date: Tue, 1 Apr 2025 10:50:03 +0200 Subject: [PATCH] fix of the weather page --- weather_project/weather/views.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/weather_project/weather/views.py b/weather_project/weather/views.py index 0170ff2..7cddce5 100644 --- a/weather_project/weather/views.py +++ b/weather_project/weather/views.py @@ -36,8 +36,9 @@ def index(request): logger.info(f"[weather_success] city={city} duration={duration:.3f}s temp={weather_data['temperature']}") except requests.HTTPError as http_err: - error = f"HTTP error: {http_err}" - logger.warning(f"[weather_http_error] city={city} error={http_err}") + error = f"Weather in {city} can't be found" + logger.error(f"[weather_http_error] city={city} error={http_err}") + weather_data = None except Exception as e: error = "Something went wrong."