Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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 |
-
|
|
|
|
|
|
|
|
|
|
|
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:
|