added option to get full consumers info
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Pünkösd Marcell 2020-04-22 02:45:57 +02:00
parent 5f68e18cff
commit bb22760426

View File

@ -1,7 +1,7 @@
import json import json
from db import redis_client from db import redis_client
from flask import jsonify, current_app from flask import jsonify, request
from flask_classful import FlaskView 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')) consumer_list = json.loads((redis_client.get("consumer_list") or b"{}").decode('utf-8'))
# jsonify and return the list of active consumers # jsonify and return the list of active consumers
if 'full' in request.args:
return jsonify(consumer_list)
else:
return jsonify([v['ip'] for k, v in consumer_list.items()]) return jsonify([v['ip'] for k, v in consumer_list.items()])