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

return json

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -8,6 +8,7 @@ from tools.final_answer import FinalAnswerTool
8
  from Gradio_UI import GradioUI
9
  import os
10
  import json
 
11
 
12
  # Below is an example of a tool that does nothing. Amaze us with your creativity !
13
  @tool
@@ -18,6 +19,7 @@ def get_live_cricket_matches()-> list: #it's import to specify the return type
18
  CRIC_API_URL = "https://api.cricapi.com/v1/currentMatches"
19
  params = {"apikey": os.environ['CRIC_API_KEY']}
20
  response = requests.get(CRIC_API_URL, params=params)
 
21
 
22
  if response.status_code == 200:
23
  data = response.json()
@@ -32,7 +34,7 @@ def get_live_cricket_matches()-> list: #it's import to specify the return type
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
 
8
  from Gradio_UI import GradioUI
9
  import os
10
  import json
11
+ from datetime import datetime
12
 
13
  # Below is an example of a tool that does nothing. Amaze us with your creativity !
14
  @tool
 
19
  CRIC_API_URL = "https://api.cricapi.com/v1/currentMatches"
20
  params = {"apikey": os.environ['CRIC_API_KEY']}
21
  response = requests.get(CRIC_API_URL, params=params)
22
+ today = datetime.today().strftime("%Y-%m-%d")
23
 
24
  if response.status_code == 200:
25
  data = response.json()
 
34
  "status": match.get("status"),
35
  "dateTimeGMT": match.get("dateTimeGMT")
36
  })
37
+ return json.dumps(match_info, indent=4)
38
  return {"error": "Unable to fetch match data"}
39
 
40
  @tool