forked from rc/aircox
cfr #121 Co-authored-by: Christophe Siraut <d@tobald.eu.org> Co-authored-by: bkfox <thomas bkfox net> Co-authored-by: Thomas Kairos <thomas@bkfox.net> Reviewed-on: rc/aircox#131 Co-authored-by: Chris Tactic <ctactic@noreply.git.radiocampus.be> Co-committed-by: Chris Tactic <ctactic@noreply.git.radiocampus.be>
This commit is contained in:
@ -70,14 +70,14 @@ class Connector:
|
||||
data = bytes("".join([str(d) for d in data]) + "\n", encoding="utf-8")
|
||||
try:
|
||||
self.socket.sendall(data)
|
||||
data = ""
|
||||
while not response_re.search(data):
|
||||
data += self.socket.recv(1024).decode("utf-8")
|
||||
resp = ""
|
||||
while not response_re.search(resp):
|
||||
resp += self.socket.recv(1024).decode("utf-8")
|
||||
|
||||
if data:
|
||||
data = response_re.sub(r"\1", data).strip()
|
||||
data = self.parse(data) if parse else self.parse_json(data) if parse_json else data
|
||||
return data
|
||||
if resp:
|
||||
resp = response_re.sub(r"\1", resp).strip()
|
||||
resp = self.parse(resp) if parse else self.parse_json(resp) if parse_json else resp
|
||||
return resp
|
||||
except Exception:
|
||||
self.close()
|
||||
if try_count > 0:
|
||||
|
Reference in New Issue
Block a user