Directions-api-clients for localhost?

  1. I have downloaded the direction-api-client project from github.
  2. created a python client with ./create.sh python
  3. installed the generated package with sudo python3 setup.py install
  4. imported e.g. the routing api successfully with
import swagger_client
routing = swagger_client.RoutingApi()

and then realized that these clients have to be used with the official graphhopper server at https://graphhopper.com, right? Or is there a way to set the URL to http://localhost:8989/route`somewhere?

It should be customizable. For the Java client this is customizable like:

client = new IsochroneApi();
client.setApiClient(new ApiClient().setBasePath("http://localhost:8080"));

ApiClient is not available via swagger and RoutingApi has no method setBasePath. To me it looks like this part is not available via swagger.

see also

It works differently for the different implementations, but changing the basePath is definitely possible with python too (because everyone has to query and test its local installations). You can either tweak the swagger config or try this:

SWAGGER_SETTINGS = {
"basePath": "http://localhost:8989"
}

taken from here

You’re right. What worked for me was changing the file

directions-api-clients/python/swagger_client/configuration.py

Specifically, I replaced self.host = "https://graphhopper.com/api/1" with self.host = "http://localhost:8989" in __init__ of the class configuration.

Great and thanks for reporting this back!