m-ric HF staff commited on
Commit
6351c15
·
verified ·
1 Parent(s): a36133a

Update tool.py

Browse files
Files changed (1) hide show
  1. tool.py +10 -8
tool.py CHANGED
@@ -23,11 +23,13 @@ class SimpleTool(Tool):
23
  if departure_time is None:
24
  from datetime import datetime
25
  monday = datetime(2025, 1, 6, 11, 0)
26
-
27
- directions_result = gmaps.directions(
28
- start_location,
29
- destination_location,
30
- mode="transit",
31
- departure_time=departure_time
32
- )
33
- return directions_result[0]["legs"][0]["duration"]["text"]
 
 
 
23
  if departure_time is None:
24
  from datetime import datetime
25
  monday = datetime(2025, 1, 6, 11, 0)
26
+ try:
27
+ directions_result = gmaps.directions(
28
+ start_location,
29
+ destination_location,
30
+ mode="transit",
31
+ departure_time=departure_time
32
+ )
33
+ return directions_result[0]["legs"][0]["duration"]["text"]
34
+ except Exception as e:
35
+ print(e, directions_result)