# API compatibility issues with python bindings

**URL:** <https://ask.openrouteservice.org/t/api-compatibility-issues-with-python-bindings/186>\
**Category:** python\
**Created:** [January 8, 2019, 1:49am UTC](https://ask.openrouteservice.org/t/api-compatibility-issues-with-python-bindings/186 "2019-01-08T01:49:29Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![flonix8](https://ask.openrouteservice.org/letter_avatar_proxy/v4/letter/f/c2a13f/32.png) [@flonix8](https://ask.openrouteservice.org/u/flonix8)\
**Post date:** [January 8, 2019, 1:49am UTC](https://ask.openrouteservice.org/t/api-compatibility-issues-with-python-bindings/186/1 "2019-01-08T01:49:29Z")

</div>

Dear ORS community,

I’ve been trying to use the python bindings (from the openrouteservice-py project) with a downloaded and locally run version of openrouteservice (using the docker build task).  
I sadly could not get it to work so far, because there seems to be an incompatibility between the latest version of the python bindings (I am using v1.1.6) and ORS v4.7.0.  
Most obvious is a mismatch in API endpoint names (e.g. for route calculation):

- python bindings call /directions
- official API documentation says its /directions
- but code (v4.7.0) clearly says its /routes

I suspect that I haven’t found the correct branch / tag yet to use with the latest version of the python bindings.

Could you point me into the right direction here? (pun intended)

---

<div class="post-metadata">

**Author:** ![timothy](https://ask.openrouteservice.org/user_avatar/ask.openrouteservice.org/timothy/32/11_2.png) [@timothy](https://ask.openrouteservice.org/u/timothy)\
**Post date:** [January 8, 2019, 6:04am UTC](https://ask.openrouteservice.org/t/api-compatibility-issues-with-python-bindings/186/2 "2019-01-08T06:04:18Z")

</div>

Hi @flonix8 - this is correct.

The reason for this is that our SDKs point to a gateway layer exposing different API slugs. Could you please open an issue in the [ors-py repo](https://github.com/GIScience/openrouteservice-py) that we can introduce a new option in the client to consider this? Thanks a bunch, Tim

---

<div class="post-metadata">

**Author:** ![nils](https://ask.openrouteservice.org/user_avatar/ask.openrouteservice.org/nils/32/6_2.png) [@nils](https://ask.openrouteservice.org/u/nils)\
**Post date:** [January 8, 2019, 7:08am UTC](https://ask.openrouteservice.org/t/api-compatibility-issues-with-python-bindings/186/3 "2019-01-08T07:08:05Z")

</div>

Hi @flonix8,

calling a local instance is described in the README:

> **[GitHub - GIScience/openrouteservice-py: :snake: The Python API to consume...](https://github.com/GIScience/openrouteservice-py#local-ors-instance)**
>
> :snake: The Python API to consume openrouteservice(s) painlessly! - GitHub - GIScience/openrouteservice-py: :snake: The Python API to consume openrouteservice(s) painlessly!

We will consider renaming `/routes` to `/directions` in ORS v5, to be released in a few weeks. Then you can use `localhost` as you would the ORS live instance.

---

<div class="post-metadata">

**Author:** ![flonix8](https://ask.openrouteservice.org/letter_avatar_proxy/v4/letter/f/c2a13f/32.png) [@flonix8](https://ask.openrouteservice.org/u/flonix8)\
**Post date:** [January 8, 2019, 1:06pm UTC](https://ask.openrouteservice.org/t/api-compatibility-issues-with-python-bindings/186/4 "2019-01-08T13:06:45Z")

</div>

Thank you for the hint @nils ! It was late last night, didn’t manage to read between the lines.  
Is the endpoint name the only thing that is different or is there something elso to keep in mind?

@timothy: Thank you. Will do!  
Is the gateway layer also on github?

---

<div class="post-metadata">

**Author:** ![timothy](https://ask.openrouteservice.org/user_avatar/ask.openrouteservice.org/timothy/32/11_2.png) [@timothy](https://ask.openrouteservice.org/u/timothy)\
**Post date:** [January 8, 2019, 1:08pm UTC](https://ask.openrouteservice.org/t/api-compatibility-issues-with-python-bindings/186/5 "2019-01-08T13:08:31Z")

</div>

@flonix8 it isn’t, no. It is used for the user management / authorization when accessing the public API. With this in place, there is no need to add an issue, I also wasn’t aware that this feature already exists in the python package 😉 cheers and happy new year!

---

<div class="post-metadata">

**Author:** ![nils](https://ask.openrouteservice.org/user_avatar/ask.openrouteservice.org/nils/32/6_2.png) [@nils](https://ask.openrouteservice.org/u/nils)\
**Post date:** [January 8, 2019, 1:21pm UTC](https://ask.openrouteservice.org/t/api-compatibility-issues-with-python-bindings/186/6 "2019-01-08T13:21:23Z")

</div>

No worries. I can see that it’s weird (and historical) that it’s called `/routes` in our repo.

There shouldn’t be anything else you need to be aware of. If you’d want to get your own gateway middleware with authentication, you’d have to alter the `_DEFAULT_BASE_URL` parameter to reflect your own:

> <https://github.com/GIScience/openrouteservice-py/blob/a93c3ac62f31de39e92901598e779dde5ad7a306/openrouteservice/client.py#L41>

Next version will have `/directions` btw:

> <https://github.com/GIScience/openrouteservice/issues/384>
>
> On the main routing api, for getting routes the /directions end point is used, b…ut locally it is /routes. 
> 
> Hopefully this could be fixed by adding /directions to the servlet listener in web.xml so that both can be used:
> 
> \`\`\`xml
> \<servlet\>
> \<servlet-name\>routing\</servlet-name\>
> \<servlet-class\>heigit.ors.services.routing.RoutingServiceServlet\</servlet-class\>
> \<load-on-startup\>1\</load-on-startup\>
> \</servlet\>
> \<servlet-mapping\>
> \<servlet-name\>routing\</servlet-name\>
> \<url-pattern\>/routes\</url-pattern\>
> \<url-pattern\>/directions\</url-pattern\>
> \</servlet-mapping\>
> \`\`\`

---

<div class="post-metadata">

**Author:** ![flonix8](https://ask.openrouteservice.org/letter_avatar_proxy/v4/letter/f/c2a13f/32.png) [@flonix8](https://ask.openrouteservice.org/u/flonix8)\
**Post date:** [January 8, 2019, 1:27pm UTC](https://ask.openrouteservice.org/t/api-compatibility-issues-with-python-bindings/186/7 "2019-01-08T13:27:18Z")

</div>

Awesome! Thanks for the help, guys.
