sreenivas-rao commited on
Commit
877cfc8
·
verified ·
1 Parent(s): a7ce619

filtering only today's matches

Browse files
Files changed (1) hide show
  1. app.py +10 -1
app.py CHANGED
@@ -23,7 +23,16 @@ def get_live_cricket_matches()-> list: #it's import to specify the return type
23
  data = response.json()
24
  if "data" in data:
25
  match_info = []
26
- return data['data']
 
 
 
 
 
 
 
 
 
27
  return {"error": "Unable to fetch match data"}
28
 
29
  @tool
 
23
  data = response.json()
24
  if "data" in data:
25
  match_info = []
26
+ for match in data["data"]:
27
+ if "date" in match and match["date"].startswith(today):
28
+ if match.get("matchType") == "t20" or match.get("matchType") == "odi":
29
+ match_info.append({
30
+ "teams": " vs ".join(match.get('teams', [])),
31
+ "score": match.get("score"),
32
+ "status": match.get("status"),
33
+ "dateTimeGMT": match.get("dateTimeGMT")
34
+ })
35
+ return match_info
36
  return {"error": "Unable to fetch match data"}
37
 
38
  @tool