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

15 lines
448 B
Python
Raw Normal View History

2020-04-21 22:55:39 +02:00
import json
2020-04-17 16:51:26 +02:00
from redisclient import redis_client
2020-04-22 00:50:40 +02:00
from flask import jsonify, request, Response
2020-04-17 16:51:26 +02:00
from flask_classful import FlaskView
class IPEndpoint(FlaskView):
def post(self):
2020-04-21 22:55:39 +02:00
consumer = json.loads(redis_client.get('currentConsumer'))
2020-04-21 19:42:47 +02:00
consumer['Host'] = request.json['ip']
2020-04-22 00:50:40 +02:00
strconsumer = json.dumps(consumer).encode('utf-8')
2020-04-21 22:55:39 +02:00
redis_client.set('currentConsumer', strconsumer)
2020-04-22 00:50:40 +02:00
return Response(status=204)