Fix data on callback function

This commit is contained in:
2019-10-30 20:32:28 +01:00
parent 0368c17321
commit b0caa42ca2
3 changed files with 24 additions and 11 deletions

View File

@@ -9,6 +9,8 @@ from georideapilib.objects import GeorideAccount
import georideapilib.api as GeorideApi
from georideapilib.socket import GeorideSocket
from threading import Thread
_LOGGER = logging.getLogger('example')
@@ -22,12 +24,21 @@ def example():
print("token 1: ", account.auth_token)
_LOGGER.info("token 1: %s", account.auth_token)
# pylint: disable=W0105
# socket = GeorideSocket()
# socket.init()
# socket.connect(account.auth_token)
# time.sleep(10)
# socket.disconnect()
def locked_locked(data):
_LOGGER.info("Locke received")
def connect_socket(account):
socket = GeorideSocket()
socket.subscribe_locked(locked_locked)
socket.init()
socket.connect(account.auth_token)
time.sleep(10)
socket.disconnect()
thread = Thread(target=connect_socket, args=(account))
thread.start()
"""
account.auth_token = GeorideApi.renewToken(account.auth_token)