jaidesign commited on
Commit
c06c404
·
verified ·
1 Parent(s): 6f9d69b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -59,7 +59,7 @@ def get_current_time_in_timezone(timezone: str) -> str:
59
 
60
 
61
  @tool
62
- def fetch_weather(city):
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)}°C"
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(fetch_weather(city_code))
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