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

18 lines
464 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-05-08 22:17:09 +02:00
from flask import request, Response
2020-04-17 16:51:26 +02:00
from flask_classful import FlaskView
class IPEndpoint(FlaskView):
2020-04-22 05:05:16 +02:00
route_base = '/ip'
2020-04-17 16:51:26 +02:00
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
2020-05-08 22:17:09 +02:00
return Response(status=204)