Spaces:
Sleeping
Sleeping
Update app.py
Browse filescorrected the indentation
app.py
CHANGED
|
@@ -25,15 +25,16 @@ def get_weather(city:str)-> str: #it's import to specify the return type
|
|
| 25 |
city : name of the city (string)
|
| 26 |
returns: weather information of the City as string.
|
| 27 |
"""
|
| 28 |
-
|
| 29 |
-
|
| 30 |
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
|
|
|
| 37 |
@tool
|
| 38 |
def get_current_time_in_timezone(timezone: str) -> str:
|
| 39 |
"""A tool that fetches the current local time in a specified timezone.
|
|
|
|
| 25 |
city : name of the city (string)
|
| 26 |
returns: weather information of the City as string.
|
| 27 |
"""
|
| 28 |
+
if not city or city.strip() == "":
|
| 29 |
+
return "No Data Found"
|
| 30 |
|
| 31 |
+
url_https = f"https://wttr.in/{city}?format=3"
|
| 32 |
+
resp=requests.get(url_https)
|
| 33 |
+
if resp.status() == 200:
|
| 34 |
+
return resp
|
| 35 |
+
else:
|
| 36 |
+
return "No Data Found"
|
| 37 |
+
|
| 38 |
@tool
|
| 39 |
def get_current_time_in_timezone(timezone: str) -> str:
|
| 40 |
"""A tool that fetches the current local time in a specified timezone.
|