fix bug in api file

replace strings with boolean and integer
This commit is contained in:
+++ 2020-11-22 22:35:27 +01:00
parent 64937e7ea9
commit d610db0d1f

View file

@ -155,11 +155,11 @@ def set_values(raw_data):
param 1: byte
return: tuple
'''
status = "true" if raw_data == b'\x01' else "false"
timestamp = str(time()).split('.')[0]
status = True if raw_data == b'\x01' else False
timestamp = int(str(time()).split('.')[0])
logging.debug('Set values for timestamp: {} and status: {}'.format(
timestamp, status))
str(timestamp), str(status)))
return (status, timestamp)
@ -235,7 +235,7 @@ def main():
logging.debug('Socket created')
mySocket.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1)
keep = mySocket.getsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE)
logging.debug('Socket keepalive: {}'format(keep))
logging.debug('Socket keepalive: {}'.format(keep))
try:
mySocket.bind((config['server']['host'], int(config['server']['port'])))
mySocket.listen(5)