|
|
|
@ -12,9 +12,10 @@ from wowlet_ws_client import WowletState, decorator_parametrized, WALLET_OPERATI
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class WowletWSClient:
|
|
|
|
|
def __init__(self, host: str = "127.0.0.1", port: int = 42069, debug: bool = False):
|
|
|
|
|
def __init__(self, host: str = "127.0.0.1", port: int = 42069, password: str = None, debug: bool = False):
|
|
|
|
|
self.host = host
|
|
|
|
|
self.port = port
|
|
|
|
|
self.password = password
|
|
|
|
|
self.ses = aiohttp.ClientSession()
|
|
|
|
|
self.debug = debug
|
|
|
|
|
|
|
|
|
@ -178,6 +179,14 @@ class WowletWSClient:
|
|
|
|
|
self._ws = await self.ses.ws_connect(f"ws://{self.host}:{self.port}")
|
|
|
|
|
self._loop_task = asyncio.create_task(self.loop())
|
|
|
|
|
|
|
|
|
|
async def authenticate(self):
|
|
|
|
|
return await self.send(json.dumps({
|
|
|
|
|
"cmd": "password",
|
|
|
|
|
"data": {
|
|
|
|
|
"password": self.password
|
|
|
|
|
}
|
|
|
|
|
}).encode())
|
|
|
|
|
|
|
|
|
|
async def send(self, data: bytes) -> None:
|
|
|
|
|
return await self._ws.send_bytes(data)
|
|
|
|
|
|
|
|
|
|