mirror of
https://github.com/mbirth/tcl_ota_check.git
synced 2024-11-09 22:06:47 +00:00
Output file hash. Also better error output.
This commit is contained in:
parent
3a2025c63a
commit
7077d6f675
@ -27,7 +27,7 @@ for prdline in prds:
|
|||||||
fc.curef = prd
|
fc.curef = prd
|
||||||
check_xml = fc.do_check()
|
check_xml = fc.do_check()
|
||||||
curef, fv, tv, fw_id, fileid, fn, fsize, fhash = fc.parse_check(check_xml)
|
curef, fv, tv, fw_id, fileid, fn, fsize, fhash = fc.parse_check(check_xml)
|
||||||
print("{}: {} ({})".format(prd, tv, model))
|
print("{}: {} {} ({})".format(prd, tv, fhash, model))
|
||||||
except (SystemExit, RequestException):
|
except (SystemExit, RequestException) as e:
|
||||||
print("{} ({}) failed.".format(prd, model))
|
print("{} failed. ({})".format(prd, str(e)))
|
||||||
continue
|
continue
|
||||||
|
@ -84,9 +84,11 @@ class FotaCheck:
|
|||||||
req = self.sess.get(url, params=params, timeout=10)
|
req = self.sess.get(url, params=params, timeout=10)
|
||||||
if req.status_code == 200:
|
if req.status_code == 200:
|
||||||
return req.text
|
return req.text
|
||||||
|
elif req.status_code == 204:
|
||||||
|
raise requests.exceptions.HTTPError("No update available.", response=req)
|
||||||
else:
|
else:
|
||||||
req.raise_for_status()
|
req.raise_for_status()
|
||||||
raise SystemExit
|
raise requests.exceptions.HTTPError("HTTP {}.".format(req.status_code), response=req)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def pretty_xml(xmlstr):
|
def pretty_xml(xmlstr):
|
||||||
|
Loading…
Reference in New Issue
Block a user