fix a couple small bugs

This commit is contained in:
Marks Polakovs 2020-04-12 22:07:37 +02:00
parent ebe08f3141
commit dd321ab600

View file

@ -136,7 +136,8 @@ async def notify_mattserver_about_sessions() -> None:
data: Dict[str, Dict[str, str]] = {} data: Dict[str, Dict[str, str]] = {}
for sid, sess in active_sessions.items(): for sid, sess in active_sessions.items():
data[sid] = sess.to_dict() data[sid] = sess.to_dict()
await session.post(config.get("mattserver", "notify_url"), json=data) async with session.post(config.get("mattserver", "notify_url"), json=data) as response:
print("Mattserver response", response)
class NotReadyException(BaseException): class NotReadyException(BaseException):
@ -343,7 +344,11 @@ async def telnet_server(
data = await reader.read(128) data = await reader.read(128)
if not data: if not data:
break break
data_str = data.decode("utf-8") try:
data_str = data.decode("utf-8")
except UnicodeDecodeError as e:
print(e)
continue
parts = data_str.rstrip().split(" ") parts = data_str.rstrip().split(" ")
print(parts) print(parts)