Skip to content
Snippets Groups Projects
Commit 197390ed authored by Erik Reid's avatar Erik Reid
Browse files

put correct module version in /version response

parent d46115b9
No related branches found
No related tags found
No related merge requests found
import functools import functools
import json import json
import pkg_resources
from flask import Blueprint, request, Response, current_app from flask import Blueprint, request, Response, current_app
from lxml import etree from lxml import etree
...@@ -9,10 +10,7 @@ from inventory_provider import juniper ...@@ -9,10 +10,7 @@ from inventory_provider import juniper
routes = Blueprint("inventory-data-query-routes", __name__) routes = Blueprint("inventory-data-query-routes", __name__)
VERSION = { API_VERSION = '0.1'
"api": "0.1",
"module": "0.1"
}
def require_accepts_json(f): def require_accepts_json(f):
...@@ -37,8 +35,17 @@ def require_accepts_json(f): ...@@ -37,8 +35,17 @@ def require_accepts_json(f):
@routes.route("/version", methods=['GET', 'POST']) @routes.route("/version", methods=['GET', 'POST'])
@require_accepts_json @require_accepts_json
def version(): def version():
VERSION = {
"api": "0.1",
"module": "0.1"
}
return Response( return Response(
json.dumps(VERSION), json.dumps({
'api': API_VERSION,
'module':
pkg_resources.get_distribution('inventory_provider').version
}),
mimetype="application/json" mimetype="application/json"
) )
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment