Get the route between two locations in miles
(start:str, end:str)
| 34 | |
| 35 | @tool.get("/get_route") |
| 36 | def get_route(start:str, end:str): |
| 37 | """Get the route between two locations in miles""" |
| 38 | # Request URL |
| 39 | url = BASE_URL + "Routes/Driving?o=json&wp.0=" + start + "&wp.1=" + end + "&key=" + KEY |
| 40 | # GET request |
| 41 | r = requests.get(url) |
| 42 | data = json.loads(r.text) |
| 43 | # Extract route information |
| 44 | route = data["resourceSets"][0]["resources"][0] |
| 45 | itinerary = route["routeLegs"][0]["itineraryItems"] |
| 46 | # Extract route text information |
| 47 | route_text = [] |
| 48 | for item in itinerary: |
| 49 | if "instruction" in item: |
| 50 | route_text.append(item["instruction"]["text"]) |
| 51 | return route_text |
| 52 | |
| 53 | @tool.get("/get_coordinates") |
| 54 | def get_coordinates(location:str): |
nothing calls this directly
no outgoing calls
no test coverage detected