Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -59,7 +59,7 @@ def get_current_time_in_timezone(timezone: str) -> str:
|
|
59 |
|
60 |
|
61 |
@tool
|
62 |
-
def
|
63 |
try:
|
64 |
url = f"https://www.weather.com/weather/today/l/{city}"
|
65 |
response = requests.get(url)
|
@@ -72,7 +72,7 @@ def fetch_weather(city):
|
|
72 |
condition_match = re.search(r'"wxPhrase":"(.*?)"', response.text)
|
73 |
|
74 |
if temp_match and condition_match:
|
75 |
-
temperature = f"{temp_match.group(1)}°
|
76 |
condition = condition_match.group(1)
|
77 |
return f"Current weather in {city}: {temperature}, {condition}"
|
78 |
|
@@ -83,7 +83,7 @@ def fetch_weather(city):
|
|
83 |
|
84 |
# Example usage
|
85 |
city_code = "San Francisco, CA"
|
86 |
-
print(
|
87 |
|
88 |
|
89 |
@tool
|
|
|
59 |
|
60 |
|
61 |
@tool
|
62 |
+
def get_weather(city):
|
63 |
try:
|
64 |
url = f"https://www.weather.com/weather/today/l/{city}"
|
65 |
response = requests.get(url)
|
|
|
72 |
condition_match = re.search(r'"wxPhrase":"(.*?)"', response.text)
|
73 |
|
74 |
if temp_match and condition_match:
|
75 |
+
temperature = f"{temp_match.group(1)}°F"
|
76 |
condition = condition_match.group(1)
|
77 |
return f"Current weather in {city}: {temperature}, {condition}"
|
78 |
|
|
|
83 |
|
84 |
# Example usage
|
85 |
city_code = "San Francisco, CA"
|
86 |
+
print(get_weather(city_code))
|
87 |
|
88 |
|
89 |
@tool
|