2
0
mirror of https://github.com/m-labs/artiq.git synced 2025-01-07 17:43:34 +08:00

afws_client: sync

This commit is contained in:
Sébastien Bourdeauducq 2024-11-28 18:55:19 +08:00
parent de8f8af3dd
commit 592f0a7708

View File

@ -79,13 +79,16 @@ class Client:
self.writer.write((" ".join(command) + "\n").encode())
async def read_line(self):
return (await self.reader.readline()).decode("ascii")
line = (await self.reader.readline()).decode("ascii")
if not line and self.reader.at_eof():
raise ConnectionError("connection was closed unexpectedly")
return line
async def read_reply(self):
return (await self.reader.readline()).decode("ascii").split()
return (await self.read_line()).split()
async def read_json(self):
return json.loads((await self.reader.readline()).decode("ascii"))
return json.loads((await self.read_line()))
async def login(self, username, password):
await self.send_command("LOGIN", username, password)