mirror of
https://github.com/mbirth/tcl_ota_check.git
synced 2024-11-10 06:16:46 +00:00
This commit is contained in:
parent
8ba67fb07e
commit
54918cfe3d
18
tclcheck.py
18
tclcheck.py
@ -40,8 +40,8 @@ def update_request(sess, serid, curef, tv, fwid, salt, vkh, fv="AAM481", mode=4,
|
|||||||
raise SystemExit
|
raise SystemExit
|
||||||
|
|
||||||
|
|
||||||
def getcode(url):
|
def getcode(sess, url):
|
||||||
req = requests.head(url)
|
req = sess.head(url)
|
||||||
return req.status_code
|
return req.status_code
|
||||||
|
|
||||||
|
|
||||||
@ -71,15 +71,19 @@ def parse_request(body):
|
|||||||
return "http://{0}{1}".format(slave, dlurl)
|
return "http://{0}{1}".format(slave, dlurl)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
def main(sess, serid, curef):
|
||||||
sess = prep_sess()
|
|
||||||
serid = "543212345000000"
|
|
||||||
curef = "PRD-63117-011"
|
|
||||||
checktext = check(sess, serid, curef)
|
checktext = check(sess, serid, curef)
|
||||||
tv, fwid, filename, filesize, filehash = parse_check(checktext)
|
tv, fwid, filename, filesize, filehash = parse_check(checktext)
|
||||||
salt = salt()
|
salt = salt()
|
||||||
vkh = vkhash(serid, curef, tv, fwid, salt)
|
vkh = vkhash(serid, curef, tv, fwid, salt)
|
||||||
updatetext = update_request(sess, serid, curef, tv, fwid, salt, vkh)
|
updatetext = update_request(sess, serid, curef, tv, fwid, salt, vkh)
|
||||||
downloadurl = parse_request(updatetext)
|
downloadurl = parse_request(updatetext)
|
||||||
print("{0}: HTTP {1}".format(filename, getcode(downloadurl)))
|
print("{0}: HTTP {1}".format(filename, getcode(sess, downloadurl)))
|
||||||
print(downloadurl)
|
print(downloadurl)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
sess = prep_sess()
|
||||||
|
serid = "543212345000000"
|
||||||
|
curef = "PRD-63117-011"
|
||||||
|
main(sess, serid, curef)
|
||||||
|
Loading…
Reference in New Issue
Block a user