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
Kovács Bence 644c2df888
All checks were successful
continuous-integration/drone/push Build is passing
unit test endpoint
2020-05-08 22:17:09 +02:00

18 lines
464 B
Python

import json
from redisclient import redis_client
from flask import 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)