So I wrote a script to request routes from the ORS-API but with a local hostes instance of ORS - problem is I can not host all of Europe, but there are coordinates not within my locally hosted area. Is there a way to have an exception, if the out-of-reach error occurs to use the global instance of ORS instead of my locally hosted one?
The script I wrote uses following code to pull requests:
body = {"coordinates":coords,"extra_info":["waycategory"]}
headers = {
'Accept': 'application/json, application/geo+json, application/gpx+xml, img/png; charset=utf-8',
'Content-Type': 'application/geo+json; charset=utf-8'
}
call = requests.post('http://127.0.0.1:8080/ors/v2/directions/driving-hgv/geojson', json=body, headers=headers)
weiter = call.text
data = json.loads(weiter)
Now I want to have an exception like, to use:
call = requests.post('http://openrouteservice.org/ors/v2/directions/driving-hgv/geojson', json=body, headers=headers)
#if out of reach-error (coordinates not in the local hosted instance)
Is there some way to do that? any hint is appreciated!!