mirror of
https://github.com/mbirth/tcl_ota_check.git
synced 2024-11-09 22:06:47 +00:00
More cleanup.
This commit is contained in:
parent
485e7b30b8
commit
75aef38a6d
@ -1,6 +1,6 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from . import tcl
|
from .tclrequest import TclRequest
|
||||||
from . import http
|
from . import http
|
||||||
from . import serverselector
|
from . import serverselector
|
||||||
|
|
||||||
@ -25,7 +25,7 @@ class RequestRunner:
|
|||||||
"""Returns a master server."""
|
"""Returns a master server."""
|
||||||
return self.server_selector.get_master_server()
|
return self.server_selector.get_master_server()
|
||||||
|
|
||||||
def run(self, query: tcl.TclRequest, timeout: int=10) -> bool:
|
def run(self, query: TclRequest, timeout: int=10) -> bool:
|
||||||
"""Runs the actual query."""
|
"""Runs the actual query."""
|
||||||
for _ in range(0, self.max_tries):
|
for _ in range(0, self.max_tries):
|
||||||
url = "{}{}{}".format(self.protocol, self.get_server(), query.uri)
|
url = "{}{}{}".format(self.protocol, self.get_server(), query.uri)
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
import xml.dom.minidom
|
||||||
|
|
||||||
from defusedxml import ElementTree
|
from defusedxml import ElementTree
|
||||||
|
|
||||||
from . import dumpmgr
|
from . import dumpmgr
|
||||||
@ -14,6 +16,11 @@ class TclResult:
|
|||||||
def delete_dump(self):
|
def delete_dump(self):
|
||||||
self.dumper.delete_last_dump()
|
self.dumper.delete_last_dump()
|
||||||
|
|
||||||
|
def pretty_xml(self):
|
||||||
|
"""Return prettified input XML with ``xml.dom.minidom``."""
|
||||||
|
mdx = xml.dom.minidom.parseString(self.raw_xml)
|
||||||
|
return mdx.toprettyxml(indent=" ")
|
||||||
|
|
||||||
class CheckResult(TclResult):
|
class CheckResult(TclResult):
|
||||||
def __init__(self, xml: str):
|
def __init__(self, xml: str):
|
||||||
super().__init__(xml)
|
super().__init__(xml)
|
||||||
|
Loading…
Reference in New Issue
Block a user