Create route in Python

Hey Im trying to work on something that helps me creating routes to collect the trash
I have a arduino that reads the volume and creates a JSON file with the id, volume and coordinates (example: Bin_001/ 75%/ 38.7278772678994, -9.138106466624363)
My problem now is that im not being able to create the routes, maybe i have something wrong


import requests
import json
from openrouteservice import client

# This code gets the list of bins that need to be picked up.
bins = ["a", "b", "c"]
needs_pick = []
coordinates = []

for x in bins:
    # This gets the information about the bin, including its ID, volume, and location.
    target_url = "" + x
    resp = requests.get(target_url)
    bin_id = resp.json()["Bin"]["id"]
    volume = 100 - resp.json()["Bin"]["Free_Volume"]
    location = resp.json()["Bin"]["Location"]

    # If the bin is more than 75% full, it needs to be picked up.
    if volume > 75:

    # Print the information about the bin.
    print("ID: " + bin_id + "\nVolume: " + str(volume) + "%\nLocation: " + str(location) + "\n")

print("Bins needed to be picked:")
for x in needs_pick:
    print("\t->" + x)

# This generates the route using Openrouteservice.
client = client.Client(api_key=API_KEY)

route = client.directions(coordinates[0], coordinates[-1], profile="driving")

# If the route was generated successfully, print the URL of the route.
if route:
    print("\nRoute URL:" + route["coordinates"])
    print("Route generation failed.")

Hi @Serrobio,

What exactly is the Error you get?
Did you actually replace YOUR_ORS_API_KEY with your API key?
Did you verify the coordinates that are sent are valid longitude,latitudes?

Best regards