From bb22760426c38e8584a4c48ae5a7d6cb865d6e6f Mon Sep 17 00:00:00 2001 From: marcsello Date: Wed, 22 Apr 2020 02:45:57 +0200 Subject: [PATCH] added option to get full consumers info --- consumer_api/views/consumers_view.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/consumer_api/views/consumers_view.py b/consumer_api/views/consumers_view.py index 8c03a07..98349c6 100644 --- a/consumer_api/views/consumers_view.py +++ b/consumer_api/views/consumers_view.py @@ -1,7 +1,7 @@ import json from db import redis_client -from flask import jsonify, current_app +from flask import jsonify, request from flask_classful import FlaskView @@ -12,4 +12,7 @@ class ConsumersView(FlaskView): consumer_list = json.loads((redis_client.get("consumer_list") or b"{}").decode('utf-8')) # jsonify and return the list of active consumers - return jsonify([v['ip'] for k, v in consumer_list.items()]) + if 'full' in request.args: + return jsonify(consumer_list) + else: + return jsonify([v['ip'] for k, v in consumer_list.items()])