From 86e01c1e33c43cc4b425ac2faf627d84425a2867 Mon Sep 17 00:00:00 2001 From: thurask Date: Mon, 5 Feb 2018 19:11:56 -0500 Subject: [PATCH] first crack at do_check --- tcllib/tclcheck.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tcllib/tclcheck.py b/tcllib/tclcheck.py index 8358ec4..55f6a15 100644 --- a/tcllib/tclcheck.py +++ b/tcllib/tclcheck.py @@ -14,8 +14,8 @@ from defusedxml import ElementTree class TclCheckMixin: """A mixin component for TCL's update request API.""" - def do_check(self, device=None, https=True, timeout=10, max_tries=5): - """Perform update request with given parameters.""" + def prep_check(self, device=None, https=True): + """Prepare URL and parameters for update request.""" protocol = "https://" if https else "http://" url = protocol + self.g2master + "/check.php" params = OrderedDict() @@ -44,7 +44,11 @@ class TclCheckMixin: params["chnl"] = self.chnl.value #params["osvs"] = self.osvs #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 for _ in range(0, max_tries): try: