summaryrefslogtreecommitdiff
path: root/kvmd/clients
diff options
context:
space:
mode:
authorMaxim Devaev <[email protected]>2024-10-21 17:46:59 +0300
committerMaxim Devaev <[email protected]>2024-10-21 17:46:59 +0300
commitcda32a083faf3e7326cfe317336e473c905c6dfd (patch)
tree19445e4098d4603f3b2cd296504a648110712af1 /kvmd/clients
parentb67a2325842a6f407d3935f8445d50cb8bf307f2 (diff)
new events model
Diffstat (limited to 'kvmd/clients')
-rw-r--r--kvmd/clients/kvmd.py13
1 files changed, 6 insertions, 7 deletions
diff --git a/kvmd/clients/kvmd.py b/kvmd/clients/kvmd.py
index ff8581ef..ddf0d024 100644
--- a/kvmd/clients/kvmd.py
+++ b/kvmd/clients/kvmd.py
@@ -222,7 +222,7 @@ class KvmdClientSession:
@contextlib.asynccontextmanager
async def ws(self) -> AsyncGenerator[KvmdClientWs, None]:
session = self.__ensure_http_session()
- async with session.ws_connect(self.__make_url("ws")) as ws:
+ async with session.ws_connect(self.__make_url("ws"), params={"legacy": 0}) as ws:
yield KvmdClientWs(ws)
def __ensure_http_session(self) -> aiohttp.ClientSession:
@@ -267,16 +267,15 @@ class KvmdClient:
)
def __make_http_session(self, user: str, passwd: str) -> aiohttp.ClientSession:
- kwargs: dict = {
- "headers": {
+ return aiohttp.ClientSession(
+ headers={
"X-KVMD-User": user,
"X-KVMD-Passwd": passwd,
"User-Agent": self.__user_agent,
},
- "connector": aiohttp.UnixConnector(path=self.__unix_path),
- "timeout": aiohttp.ClientTimeout(total=self.__timeout),
- }
- return aiohttp.ClientSession(**kwargs)
+ connector=aiohttp.UnixConnector(path=self.__unix_path),
+ timeout=aiohttp.ClientTimeout(total=self.__timeout),
+ )
def __make_url(self, handle: str) -> str:
assert not handle.startswith("/"), handle