mirror of
https://github.com/mbirth/tcl_ota_check.git
synced 2024-11-10 06:16:46 +00:00
Build checksum-payload with proper JSON.
This commit is contained in:
parent
1aed0263ae
commit
17d465fc87
@ -402,13 +402,17 @@ class FotaCheck:
|
|||||||
def do_checksum(self, encslave, address, uri):
|
def do_checksum(self, encslave, address, uri):
|
||||||
url = "http://" + encslave + "/checksum.php"
|
url = "http://" + encslave + "/checksum.php"
|
||||||
params = self.get_creds2()
|
params = self.get_creds2()
|
||||||
params[b"address"] = bytes('{"' + address + '":"' + uri + '"}', "utf-8")
|
|
||||||
|
payload = {address: uri}
|
||||||
|
payload_json = json.dumps(payload)
|
||||||
|
params[b"address"] = bytes(payload_json, "utf-8")
|
||||||
|
|
||||||
#print(repr(dict(params)))
|
#print(repr(dict(params)))
|
||||||
req = self.sess.post(url, data=params)
|
req = self.sess.post(url, data=params)
|
||||||
if req.status_code == 200:
|
if req.status_code == 200:
|
||||||
req.encoding = "utf-8" # Force encoding as server doesn't give one
|
req.encoding = "utf-8" # Force encoding as server doesn't give one
|
||||||
self.write_dump(req.text)
|
self.write_dump(req.text)
|
||||||
|
# <ENCRYPT_FOOTER>2abfa6f6507044fec995efede5d818e62a0b19b5</ENCRYPT_FOOTER> means ERROR (invalid ADDRESS!)
|
||||||
return req.text
|
return req.text
|
||||||
else:
|
else:
|
||||||
print("CHECKSUM: " + repr(req))
|
print("CHECKSUM: " + repr(req))
|
||||||
|
Loading…
Reference in New Issue
Block a user