diff options
author | Devaev Maxim <[email protected]> | 2019-04-09 06:17:52 +0300 |
---|---|---|
committer | Devaev Maxim <[email protected]> | 2019-04-09 06:17:52 +0300 |
commit | 0460c2e83be9837fab01b116402d54c6b32ee4e4 (patch) | |
tree | e87945c69ff7640ee98c560a66ebcf4159b00c5c | |
parent | 3a68e82f94815660d23fa771e8d6fdbfdbb0bee6 (diff) |
streamer: send user-agent
-rw-r--r-- | kvmd/apps/kvmd/streamer.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/kvmd/apps/kvmd/streamer.py b/kvmd/apps/kvmd/streamer.py index 84eb68a2..6c8e3c75 100644 --- a/kvmd/apps/kvmd/streamer.py +++ b/kvmd/apps/kvmd/streamer.py @@ -36,6 +36,8 @@ from ...logging import get_logger from ... import gpio +from ... import __version__ + # ===== class Streamer: # pylint: disable=too-many-instance-attributes @@ -118,10 +120,13 @@ class Streamer: # pylint: disable=too-many-instance-attributes async def get_state(self) -> Dict: session = self.__ensure_session() - url = "http://%s:%d/state" % (self.__host, self.__port) state = None try: - async with session.get(url, timeout=self.__timeout) as response: + async with session.get( + url="http://%s:%d/state" % (self.__host, self.__port), + headers={"User-Agent": "KVMD/%s" % (__version__)}, + timeout=self.__timeout, + ) as response: response.raise_for_status() state = (await response.json())["result"] except (aiohttp.ClientConnectionError, aiohttp.ServerConnectionError): |