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.
producer-endpoint/endpoints.py
marcsello 20bee844ef
All checks were successful
continuous-integration/drone/push Build is passing
Fixed wrong endpoint name
2020-04-22 05:05:16 +02:00

17 lines
472 B
Python

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)