import json from redisclient import redis_client from flask import jsonify, request, Response from flask_classful import FlaskView class IPEndpoint(FlaskView): route_base = '/ip' def post(self): consumer = json.loads(redis_client.get('currentConsumer')) consumer['Host'] = request.json['ip'] strconsumer = json.dumps(consumer).encode('utf-8') redis_client.set('currentConsumer', strconsumer) return Response(status=204)