mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2025-12-12 09:10:30 +08:00
streamer: send user-agent
This commit is contained in:
parent
3a68e82f94
commit
0460c2e83b
@ -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):
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user