After some testing V8 seem to work fine to get Isochrone on locations that failed in previous attempts.
However I am encoutering a new problem :
I get what seem to be random “502 proxy error”. Whats bugging me is that this error can be thrown for a given location , but if i make the call again with the same parameters the request is successfull.
I thought it might me be due to API token limitations , but incresing the delay between request does not seem to have an impact.
Is there something I am missing with public API limitations / known load issues on server side or ?
Here is the error I get :
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>502 Proxy Error</title>
</head><body>
<h1>Proxy Error</h1>
<p>The proxy server received an invalid
response from an upstream server.<br />
The proxy server could not handle the request<p>Reason: <strong>Error reading from remote server</strong></p></p>
</body></html>
In this case
parameters were as follow :
{'locations': [[2.372825724542572, 48.837045119237075]], 'range': [300], 'range_type': 'time', 'attributes': ['area'], 'location_type': 'start'}
Here is the code used to make calls to the API
import requests
import time
def Isochrone_call(locations,delay,id):
url = "https://api.openrouteservice.org/v2/isochrones/foot-walking"
key = xxxx
headers = {
"Authorization": key,
"Accept": 'application/json, application/geo+json, application/gpx+xml, img/png; charset=utf-8',
"Content-Type": "application/json; charset=utf-8"
}
params = {
"locations": locations,
"range": [delay],
"range_type": "time",
"attributes": ["area"],
"location_type": "start"
}
print("...")
time.sleep(10)
print(id,": ")
response = requests.post(url, json=params, headers=headers)
if response.status_code == 200:
data = response.json()
#print(f"Réponse :{response.content}\n \n" )
print("OK \n")
return data
else:
print("\n L'appel API a échoué avec le code d'erreur :", response.status_code,"\n")
print("Contenu de la réponse :", response.content.decode("utf-8"),"\n")
print("Contenu de params :", params,"\n")
return None