kk20krishna commited on
Commit
cd588fa
·
verified ·
1 Parent(s): 59f187d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -18,8 +18,10 @@ def get_current_weather_condition_in_location(location: str) -> str:
18
  api_url = f"https://api.weatherapi.com/v1/current.json?key=80b3c1b0b84648de88b204919251802&q='{location}'"
19
  # Get current weather condition in a location
20
  response = requests.get(api_url)
 
 
21
  weather_condition = response.json()["current"]["condition"]["text"]
22
- return f"The current weather condition in {location} is: {weather_condition}"
23
  except Exception as e:
24
  return f"Error fetching weather condition for location '{location}': {str(e)}"
25
 
 
18
  api_url = f"https://api.weatherapi.com/v1/current.json?key=80b3c1b0b84648de88b204919251802&q='{location}'"
19
  # Get current weather condition in a location
20
  response = requests.get(api_url)
21
+ last_updated = response.json()["current"]["last_updated"]
22
+ temp = response.json()["current"]["temp_c"]
23
  weather_condition = response.json()["current"]["condition"]["text"]
24
+ return f"The weather condition in {location} as of {last_updated} is: {weather_condition} and temprature is {temp}"
25
  except Exception as e:
26
  return f"Error fetching weather condition for location '{location}': {str(e)}"
27