This repository has been archived on 2020-09-24. You can view files and clone it, but cannot push or open issues or pull requests.
consumer-api/consumer_api/views/consumers_view.py
Fabian 93beb10c49
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
dev
2020-04-01 00:31:13 +02:00

14 lines
425 B
Python

import json
from db import redis_client
from flask import jsonify, current_app
from flask_classful import FlaskView
class ConsumersView(FlaskView):
def get(self):
consumer_list = json.loads((redis_client.get("consumer_list") or b"{}").decode('utf-8'))
current_app.logger.warning(jsonify([v['ip'] for k, v in consumer_list.items()]))
return jsonify([v['ip'] for k, v in consumer_list.items()])