ZainebS commited on
Commit
4656d2c
·
verified ·
1 Parent(s): 6139287

Update app.py

Browse files

extracted units for windspeed

Files changed (1) hide show
  1. app.py +2 -1
app.py CHANGED
@@ -42,8 +42,9 @@ def get_weather(city:str,lat: float, lng:float)-> str:
42
  if response.status_code == 200:
43
  data = response.json()
44
  weather = data["current_weather"]
 
45
  description = weather_descriptions[weather['weathercode']]
46
- windspeed = weather['windspeed']
47
  return f"The weather in {city} is {weather['temperature']}°C - {description} - {windspeed}."
48
  else:
49
  return "Error fetching weather data."
 
42
  if response.status_code == 200:
43
  data = response.json()
44
  weather = data["current_weather"]
45
+ weather_units = data["current_weather_units"]
46
  description = weather_descriptions[weather['weathercode']]
47
+ windspeed = weather['windspeed'] + weather_units['windspeed']
48
  return f"The weather in {city} is {weather['temperature']}°C - {description} - {windspeed}."
49
  else:
50
  return "Error fetching weather data."