Server timeout error

Hi,

I have currently undergoing with server request time error.

The code below is in python, which is the line current problem is caused.

routing_req = clnt.directions(**request)

The error message is attached.

I want to know if i have to request in other ways, which means that i have written the code in a wrong way, OR if this problem is caused by the openrouteservice server itself.

It would be much appreciated if i can get a quick answer with regard to this problem.


Thank you!

And how exactly should we know what your code looks like please?

Aside from the fact, that you should please not make us look at screenshots of code! That’s not even showing anything.

Sorry for the vagueness.
The function that error occurs is as follows.
The bolded line causes the ‘timeout’ error.

def t_matrix(data1):   
    
    print(f'====== t matrix generation started! ======')
    
    clnt = client.Client(key=api_key)
    
    data = dict_to_list(data1)
    remaining = data

    time_matrix = []
    road_matrix = []
    for i in tqdm(range(len(data))):
        time_list = []
        road_list = []

        for j in range(len(remaining)):
            time.sleep(1)            

            if i == j :
                time_list.append(0)
                road_list.append(0)
            elif i != j :
                                
                request = {"coordinates": [[data[i][0],data[i][1]],[remaining[j][0],remaining[j][1]]],
                            "preference": "fastest",
                            "extra_info": [
                            "waycategory",
                            "waytype"],
                            "profile" : 'driving-car'
                            }
                
                **routing_req = clnt.directions(**request)**
 
                
                if len(routing_req['routes'][0]['summary']) > 0:
                    time_list.append((routing_req['routes'][0]['summary']['duration']))
                    
                else:
                    pass

                road = routing_req['routes'][0]['extras']['waytypes']['values']

                r_list = [road[t][-1] for t in range(len(road))]

                road_dict = Counter(r_list)
                unique_road = list(set(r_list))

                print(unique_road)
            
                score = {0:0, 1:1, 2:2, 3:5, 4:5, 5:5, 6:5, 7:5, 8:5, 9:5, 10:5}
                
                pt = 0
                total = 0

                for l in unique_road:
                    pt += road_dict[l]*score[l]
                    total += road_dict[l]
                    print(f'pt ==> {pt}')
                    print(f'total ==> {total}')
                    
                total_pts = pt/total
                print(total_pts)
                road_list.append(total_pts)                

        time_matrix.append(time_list)
        road_matrix.append(road_list)
        
    return time_matrix, road_matrix

The data that gets input to the above function looks like below.

data1=[
{'coordinates': [37.38846, 127.12306], 'name': 'depot', 'capacity': 1},
{'coordinates': [37.38711, 127.12264], 'name': 'CGV', 'capacity': 2},
{'coordinates': [37.38804, 127.12339], 'name': '스타벅스', 'capacity': 1},
{'coordinates': [37.38591, 127.12331], 'name': '우리은행', 'capacity': 2}, 
{'coordinates': [37.38599, 127.12138], 'name': 'Mate Hotel', 'capacity': 1},
{'coordinates': [37.38544, 127.12057], 'name': '이마트 24', 'capacity': 2},
{'coordinates': [37.38442, 127.12174], 'name': '종로상회', 'capacity': 1},
{'coordinates': [37.38379, 127.12281], 'name': '하나은행', 'capacity': 2}]   

Once again, sorry for the vagueness.