jaidesign commited on
Commit
a53289d
·
verified ·
1 Parent(s): 915b7a7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -76,7 +76,12 @@ def get_weather(location: str = "auto") -> str:
76
  response = requests.get(BASE_URL)
77
  response.raise_for_status()
78
 
79
- weather_data = response.text.strip()
 
 
 
 
 
80
  return f"The current Weather in {location} is: {weather_data[0]}, Temperature: {weather_data[1]}, Humidity: {weather_data[2]}""
81
 
82
  except requests.exceptions.RequestException as e:
 
76
  response = requests.get(BASE_URL)
77
  response.raise_for_status()
78
 
79
+ # Split the response into separate parts
80
+ weather_data = response.text.strip().split("|")
81
+
82
+ if len(weather_data) != 3:
83
+ return "Error: Unexpected response format"
84
+
85
  return f"The current Weather in {location} is: {weather_data[0]}, Temperature: {weather_data[1]}, Humidity: {weather_data[2]}""
86
 
87
  except requests.exceptions.RequestException as e: