File: version.py

package info (click to toggle)
zwave-js-server-python 0.67.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,820 kB
  • sloc: python: 15,886; sh: 21; javascript: 16; makefile: 2
file content (16 lines) | stat: -rw-r--r-- 401 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
"""Version helper."""

from __future__ import annotations

import aiohttp

from .model.version import VersionInfo


async def get_server_version(url: str, session: aiohttp.ClientSession) -> VersionInfo:
    """Return a server version."""
    client = await session.ws_connect(url)
    try:
        return VersionInfo.from_message(await client.receive_json())
    finally:
        await client.close()