1
0
mirror of https://github.com/mbirth/tcl_ota_check.git synced 2024-11-09 22:06:47 +00:00
This commit is contained in:
thurask 2017-08-05 12:00:45 -04:00 committed by GitHub
parent 8ba67fb07e
commit 54918cfe3d

View File

@ -40,8 +40,8 @@ def update_request(sess, serid, curef, tv, fwid, salt, vkh, fv="AAM481", mode=4,
raise SystemExit
def getcode(url):
req = requests.head(url)
def getcode(sess, url):
req = sess.head(url)
return req.status_code
@ -71,15 +71,19 @@ def parse_request(body):
return "http://{0}{1}".format(slave, dlurl)
if __name__ == "__main__":
sess = prep_sess()
serid = "543212345000000"
curef = "PRD-63117-011"
def main(sess, serid, curef):
checktext = check(sess, serid, curef)
tv, fwid, filename, filesize, filehash = parse_check(checktext)
salt = salt()
vkh = vkhash(serid, curef, tv, fwid, salt)
updatetext = update_request(sess, serid, curef, tv, fwid, salt, vkh)
downloadurl = parse_request(updatetext)
print("{0}: HTTP {1}".format(filename, getcode(downloadurl)))
print("{0}: HTTP {1}".format(filename, getcode(sess, downloadurl)))
print(downloadurl)
if __name__ == "__main__":
sess = prep_sess()
serid = "543212345000000"
curef = "PRD-63117-011"
main(sess, serid, curef)