From 7077d6f6759741333c60bcfa58dd32174fc8726c Mon Sep 17 00:00:00 2001 From: Markus Birth Date: Fri, 1 Sep 2017 18:34:15 +0200 Subject: [PATCH] Output file hash. Also better error output. --- tclcheck_all.py | 6 +++--- tcllib.py | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/tclcheck_all.py b/tclcheck_all.py index b3beeae..536603b 100644 --- a/tclcheck_all.py +++ b/tclcheck_all.py @@ -27,7 +27,7 @@ for prdline in prds: fc.curef = prd check_xml = fc.do_check() curef, fv, tv, fw_id, fileid, fn, fsize, fhash = fc.parse_check(check_xml) - print("{}: {} ({})".format(prd, tv, model)) - except (SystemExit, RequestException): - print("{} ({}) failed.".format(prd, model)) + print("{}: {} {} ({})".format(prd, tv, fhash, model)) + except (SystemExit, RequestException) as e: + print("{} failed. ({})".format(prd, str(e))) continue diff --git a/tcllib.py b/tcllib.py index c5fec1c..1b98994 100644 --- a/tcllib.py +++ b/tcllib.py @@ -84,9 +84,11 @@ class FotaCheck: req = self.sess.get(url, params=params, timeout=10) if req.status_code == 200: return req.text + elif req.status_code == 204: + raise requests.exceptions.HTTPError("No update available.", response=req) else: req.raise_for_status() - raise SystemExit + raise requests.exceptions.HTTPError("HTTP {}.".format(req.status_code), response=req) @staticmethod def pretty_xml(xmlstr):