mirror of
https://github.com/mbirth/tcl_ota_check.git
synced 2024-11-09 22:06:47 +00:00
first crack at do_check
This commit is contained in:
parent
58a270275d
commit
86e01c1e33
@ -14,8 +14,8 @@ from defusedxml import ElementTree
|
|||||||
|
|
||||||
class TclCheckMixin:
|
class TclCheckMixin:
|
||||||
"""A mixin component for TCL's update request API."""
|
"""A mixin component for TCL's update request API."""
|
||||||
def do_check(self, device=None, https=True, timeout=10, max_tries=5):
|
def prep_check(self, device=None, https=True):
|
||||||
"""Perform update request with given parameters."""
|
"""Prepare URL and parameters for update request."""
|
||||||
protocol = "https://" if https else "http://"
|
protocol = "https://" if https else "http://"
|
||||||
url = protocol + self.g2master + "/check.php"
|
url = protocol + self.g2master + "/check.php"
|
||||||
params = OrderedDict()
|
params = OrderedDict()
|
||||||
@ -44,7 +44,11 @@ class TclCheckMixin:
|
|||||||
params["chnl"] = self.chnl.value
|
params["chnl"] = self.chnl.value
|
||||||
#params["osvs"] = self.osvs
|
#params["osvs"] = self.osvs
|
||||||
#params["ckot"] = self.ckot.value
|
#params["ckot"] = self.ckot.value
|
||||||
|
return url, params
|
||||||
|
|
||||||
|
def do_check(self, device=None, https=True, timeout=10, max_tries=5):
|
||||||
|
"""Perform update request with given parameters."""
|
||||||
|
url, params = self.prep_check(device, https)
|
||||||
last_response = None
|
last_response = None
|
||||||
for _ in range(0, max_tries):
|
for _ in range(0, max_tries):
|
||||||
try:
|
try:
|
||||||
|
Loading…
Reference in New Issue
Block a user