jbisal commited on
Commit
c08f631
·
verified ·
1 Parent(s): 06d0f38

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -0
app.py CHANGED
@@ -35,7 +35,30 @@ def get_current_time_in_timezone(timezone: str) -> str:
35
  except Exception as e:
36
  return f"Error fetching time for timezone '{timezone}': {str(e)}"
37
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
 
 
39
  final_answer = FinalAnswerTool()
40
  search_tool = DuckDuckGoSearchTool()
41
  visit_webpage_tool = VisitWebpageTool()
 
35
  except Exception as e:
36
  return f"Error fetching time for timezone '{timezone}': {str(e)}"
37
 
38
+ @tool
39
+ def get_boxScores() -> list:
40
+ """A tool that fetches the URLs to the boxscores for each of last nights nba games
41
+ Args:
42
+
43
+ """
44
+ # Base URL of the main page containing box score links
45
+ BASE_URL = "https://www.basketball-reference.com"
46
+ MAIN_URL = f"{BASE_URL}/boxscores/"
47
+ try:
48
+ response = requests.get(MAIN_URL)
49
+ soup = BeautifulSoup(response.text, 'html.parser')
50
+ box_score_links = []
51
+ # Find all box score links
52
+ for link in soup.find_all('a', href=True):
53
+ href = link['href']
54
+ if '/boxscores/' in href and href.endswith('.html') and 's/202' in href:
55
+ box_score_links.append(BASE_URL + href)
56
+ return set(box_score_links)
57
+ execpt Exception as e:
58
+ return "Error fetching boxScores"
59
+
60
 
61
+ box_scores = get_boxscores()
62
  final_answer = FinalAnswerTool()
63
  search_tool = DuckDuckGoSearchTool()
64
  visit_webpage_tool = VisitWebpageTool()