1
0
mirror of https://github.com/mbirth/tcl_ota_check.git synced 2024-09-19 22:33:25 +01:00

Output file hash. Also better error output.

This commit is contained in:
Markus Birth 2017-09-01 18:34:15 +02:00
parent 3a2025c63a
commit 7077d6f675
2 changed files with 6 additions and 4 deletions

View File

@ -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

View File

@ -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):