NatKBaca commited on
Commit
addcbff
·
verified ·
1 Parent(s): c3e1530

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -30,8 +30,9 @@ def geocode_location(city: str) -> dict:
30
  response = requests.get(api_url)
31
  if response.status_code == 200:
32
  data = response.json()
33
- lat_lng = {"lat": data.get("latitude", "No latitude information available"),
34
- "lng": data.get("longitude", "No longitude information available"),}
 
35
  return lat_lng
36
  else:
37
  return "Error: Unable to fetch weather data."
 
30
  response = requests.get(api_url)
31
  if response.status_code == 200:
32
  data = response.json()
33
+ result = data.get("results", [])[0] if data.get("results") else None
34
+ lat_lng = {"lat": result.get("latitude", "No latitude information available"),
35
+ "lng": result.get("longitude", "No longitude information available")}
36
  return lat_lng
37
  else:
38
  return "Error: Unable to fetch weather data."