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

fixed json conversion errors

parent 20ebeb55
No related branches found
No related tags found
No related merge requests found
......@@ -49,7 +49,7 @@ def get_interface_details(equipment_name, interface):
r = common.get_redis()
key = 'opsdb:interface_services:%s:%s' % (equipment_name, interface)
# TODO: handle None (return 404)
return jsonify(r.get(key).decode('utf-8'))
return jsonify(json.loads(r.get(key).decode('utf-8')))
@routes.route("/equipment-location")
......@@ -67,20 +67,22 @@ def get_all_equipment_locations():
@routes.route("/equipment-location/<path:equipment_name>")
def get_equipment_location(equipment_name):
r = common.get_redis()
return jsonify(r.get('opsdb:location:' + equipment_name))
result = r.get('opsdb:location:' + equipment_name)
# TODO: handle None (return 404)
return jsonify(json.loads(result.decode('utf-8')))
@routes.route("/circuit-hierarchy/children/<int:parent_id>")
def get_children(parent_id):
r = common.get_redis()
return Response(
r.get('opsdb:services:children:%d' % parent_id),
mimetype="application/json")
result = r.get('opsdb:services:children:%d' % parent_id)
# TODO: handle None (return 404)
return jsonify(json.loads(result.decode('utf-8')))
@routes.route("/circuit-hierarchy/parents/<int:child_id>")
def get_parents(child_id):
r = common.get_redis()
return Response(
r.get('opsdb:services:parents:%d' % child_id),
mimetype="application/json")
result = r.get('opsdb:services:parents:%d' % child_id)
# TODO: handle None (return 404)
return jsonify(json.loads(result.decode('utf-8')))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment