chore: Update weather.py to use logger instead of print statements
Browse files- kitt/skills/weather.py +8 -3
kitt/skills/weather.py
CHANGED
@@ -13,7 +13,7 @@ def get_weather_current_location():
|
|
13 |
Returns:
|
14 |
dict: The weather data in the specified location.
|
15 |
"""
|
16 |
-
|
17 |
f"get_weather: location is empty, using the vehicle location. ({vehicle.location})"
|
18 |
)
|
19 |
location = vehicle.location
|
@@ -46,8 +46,11 @@ def get_weather(location: str = "here"):
|
|
46 |
response = requests.get(url)
|
47 |
|
48 |
if response.status_code != 200:
|
49 |
-
|
|
|
|
|
50 |
return f"Failed to get weather data, try again", response
|
|
|
51 |
|
52 |
# Parse the JSON response
|
53 |
weather_data = response.json()
|
@@ -140,5 +143,7 @@ def get_forecast(city_name: str = "", when=0, **kwargs):
|
|
140 |
return forecast_sentences
|
141 |
else:
|
142 |
# Handle errors
|
143 |
-
|
|
|
|
|
144 |
return f"error {response.status_code}"
|
|
|
13 |
Returns:
|
14 |
dict: The weather data in the specified location.
|
15 |
"""
|
16 |
+
logger.info(
|
17 |
f"get_weather: location is empty, using the vehicle location. ({vehicle.location})"
|
18 |
)
|
19 |
location = vehicle.location
|
|
|
46 |
response = requests.get(url)
|
47 |
|
48 |
if response.status_code != 200:
|
49 |
+
logger.warning(
|
50 |
+
f"Failed to get weather data: {response.status_code}, {response.text}"
|
51 |
+
)
|
52 |
return f"Failed to get weather data, try again", response
|
53 |
+
logger.info(f"get_weather: response: {response.text}")
|
54 |
|
55 |
# Parse the JSON response
|
56 |
weather_data = response.json()
|
|
|
143 |
return forecast_sentences
|
144 |
else:
|
145 |
# Handle errors
|
146 |
+
logger.error(
|
147 |
+
f"Failed to get weather data: {response.status_code}, {response.text}"
|
148 |
+
)
|
149 |
return f"error {response.status_code}"
|