mirror of
https://github.com/m-labs/artiq.git
synced 2025-01-08 18:13:34 +08:00
afws_client: sync
This commit is contained in:
parent
de8f8af3dd
commit
592f0a7708
@ -79,13 +79,16 @@ class Client:
|
|||||||
self.writer.write((" ".join(command) + "\n").encode())
|
self.writer.write((" ".join(command) + "\n").encode())
|
||||||
|
|
||||||
async def read_line(self):
|
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):
|
async def read_reply(self):
|
||||||
return (await self.reader.readline()).decode("ascii").split()
|
return (await self.read_line()).split()
|
||||||
|
|
||||||
async def read_json(self):
|
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):
|
async def login(self, username, password):
|
||||||
await self.send_command("LOGIN", username, password)
|
await self.send_command("LOGIN", username, password)
|
||||||
|
Loading…
Reference in New Issue
Block a user