cleanup quotes in connection status messages
This commit is contained in:
parent
49c2e4f1d7
commit
3047fde812
@ -59,20 +59,17 @@ class KlippyRest:
|
|||||||
if data:
|
if data:
|
||||||
self.status = ''
|
self.status = ''
|
||||||
else:
|
else:
|
||||||
logging.error(self.status)
|
logging.error(self.status.replace('\n', '>>'))
|
||||||
return data
|
return data
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def format_status(status):
|
def format_status(status):
|
||||||
try:
|
try:
|
||||||
rep = {"HTTPConnectionPool": "", "/server/info ": "", "Caused by ": "", "(": "", ")": "", ": ": "\n"}
|
rep = {"HTTPConnectionPool": "", "/server/info ": "", "Caused by ": "", "(": "", ")": "",
|
||||||
|
": ": "\n", "'": "", "`": "", "\"": ""}
|
||||||
rep = {re.escape(k): v for k, v in rep.items()}
|
rep = {re.escape(k): v for k, v in rep.items()}
|
||||||
pattern = re.compile("|".join(rep.keys()))
|
pattern = re.compile("|".join(rep.keys()))
|
||||||
err = ""
|
status = pattern.sub(lambda m: rep[re.escape(m.group(0))], f"{status}").split("\n")
|
||||||
for _ in pattern.sub(lambda m: rep[re.escape(m.group(0))], f"{status}").split("\n"):
|
return "\n".join(_ for _ in status if "urllib3" not in _ and _ != "")
|
||||||
if not _ or "urllib3" in _ or _ == "":
|
|
||||||
continue
|
|
||||||
err += _ + "\n"
|
|
||||||
return err
|
|
||||||
except TypeError or KeyError:
|
except TypeError or KeyError:
|
||||||
return status
|
return status
|
||||||
|
Loading…
x
Reference in New Issue
Block a user