51 lines
1.1 KiB
Python
51 lines
1.1 KiB
Python
#!/usr/bin/env python
|
|
|
|
#IDE JÖNNEK IMPORTOK
|
|
|
|
"""
|
|
Main Flask RESTful API
|
|
"""
|
|
|
|
__author__ = "@tormakris"
|
|
__copyright__ = "Copyright 2020, GoldenPogácsa Team"
|
|
__module_name__ = "consumerlocator"
|
|
__version__text__ = "1"
|
|
|
|
|
|
class ConsumerLocator:
|
|
|
|
def __init__(self):
|
|
self.consumerList = ["KnownHost"]
|
|
self.currentConsumer = self.consumerList[0]
|
|
pass
|
|
|
|
def learnConsumerList(self):
|
|
""""
|
|
Learns the list of consumers.
|
|
"""
|
|
pass
|
|
|
|
def updateConsumer(self):
|
|
"""
|
|
Updates the current consumer.
|
|
:return:
|
|
"""
|
|
self.currentConsumer = self.consumerList[0]
|
|
|
|
def getCurrentConsumer(self):
|
|
"""
|
|
Returns the currently selected consumer.
|
|
:return: the current consumer
|
|
"""
|
|
return self.currentConsumer
|
|
|
|
def checkConsumer(self):
|
|
"""
|
|
Check the consumers health.
|
|
:return: True if OK, False if fail
|
|
"""
|
|
if communicator.ping(self.currentConsumer):
|
|
return True
|
|
else:
|
|
return False
|