import justrouting
client = justrouting.Client("YOUR_API_KEY")
# Directions
route = client.routes.get(justrouting.RouteRequest(
origin=[103.708362, 1.357371],
destination=[103.984748, 1.352212],
overview="full",
))
# Distance Matrix (just the depot row)
m = client.matrix.get(justrouting.MatrixRequest(
coordinates=[[103.708362, 1.357371], [103.8514, 1.2897], [103.984748, 1.352212]],
sources=[0], destinations=[1, 2],
))
print(m.duration(0, 1)) # seconds or None
# Fleet Optimization
solution = client.vroom.solve(justrouting.VroomRequest(
vehicles=[justrouting.Vehicle(id=1, profile="car",
start=[103.792, 1.324], end=[103.792, 1.324])],
jobs=[justrouting.Job(id=1, location=[103.797, 1.310])],
))