path.direction = andyamo_instruction.get("type", 0)
# Check if path.direction is an int or can be cast to an int
try:
# Attempt to cast to an int
path.direction = int(path.direction)
except (ValueError, TypeError):
# If casting fails, default to 0
path.direction = 0
# Valhalla format: https://valhalla.github.io/valhalla/api/turn-by-turn/api-reference/#trip-legs-and-maneuvers
if path.direction == 10: ## means right turn as defined in Valhalla (See link above)
path.direction = 90
elif path.direction == 15: ## means left turn as defined in Valhalla (See link above)
path.direction = -90