Issue "int object not iterable" when calling optimazion

Hello everyone!

I need your help on my issue when I try to run route optimization with this issue

thank you!

Hi @Vu1,

best read the documentation first on what has to go into the vehicles property:
https://openrouteservice.org/dev/#/api-docs/optimization/post

Best regards

thanks @amandus

I tried to set up vehicles but there exists an error of “no description”. This’s my example code. Can you please help!

import pandas as pd
import openrouteservice as ors
import openpyxl

file="C:/Users/vu.huynh2/Documents/RTM guide file/Master data/Master data.xlsx"
data=pd.read_excel(file,sheet_name="Long_Lat",skiprows=5,engine="openpyxl")

coordinates=[]

for index,row in data.iterrows():
    coordinates.append([row['Longtitude'],row['Latitude']])

def optimize_routes(coordinates):
    client=ors.Client(key="my-key")
    request={
        'jobs': coordinates,
        'vehicles': [
    {
      "id": 1,
      "start": [
        2.35044,
        48.71764
      ],
      "end": [
        2.35044,
        48.71764
      ],
      "capacity": [
        4
      ],
      "skills": [
        1,
        14
      ],
      "time_window": [
        1600416000,
        1600430400
      ]
    },
    {
      "id": 2,
      "start": [
        2.35044,
        48.71764
      ],
      "end": [
        2.35044,
        48.71764
      ],
      "capacity": [
        4
      ],
      "skills": [
        2,
        14
      ],
      "time_window": [
        1600416000,
        1600430400
      ],
      "breaks": [
        {
          "id": 2,
          "service": 300,
          "time_windows": [
            [
              1600423200,
              1600425000
            ]
          ]
        }
      ]
    }
  ]
    }

    response=client.optimization(**request)
    return response

response=optimize_routes(coordinates)

optimized_routes=[]
for route in response['routes']:
    optimized_routes=[coordinates[index] for index in route['steps']]

optimized_routes.append(optimized_routes)

data['optimized_route']=optimized_routes
data.to_excel('route optimization test.xlsx', index=False)

could you paste the full error please ?