Add api versionning

This commit is contained in:
Julien Duponchelle committed 2015-02-04 10:24:59 +01:00
1 parent 119bebee25
commit 08158884a4
3 files changed
+5 -4

No files matched your search

+2 -2
View File
@@ -45,7 +45,7 @@ class Query:
return self._fetch("DELETE", path, **kwargs)
def _get_url(self, path):
return "http://{}:{}{}".format(self._host, self._port, path)
return "http://{}:{}/v1{}".format(self._host, self._port, path)
def _fetch(self, method, path, body=None, **kwargs):
"""Fetch an url, parse the JSON and return response
@@ -74,7 +74,7 @@ class Query:
asyncio.async(go(future, response))
self._loop.run_until_complete(future)
response.body = future.result()
response.route = response.headers.get('X-Route', None)
response.route = response.headers.get('X-Route', None).replace("/v1", "")
if response.body is not None:
try: