1
0
mirror of https://github.com/mbirth/tcl_ota_check.git synced 2024-09-20 06:43:26 +01:00
tcl_ota_check/tcllib/tclencheader.py

17 lines
586 B
Python
Raw Normal View History

# -*- coding: utf-8 -*-
2018-02-03 12:46:17 +00:00
class TclEncHeaderMixin:
def do_encrypt_header(self, encslave, address):
params = self.get_creds2()
params[b"address"] = bytes(address, "utf-8")
url = "http://" + encslave + "/encrypt_header.php"
req = self.sess.post(url, data=params, verify=False)
# Expect "HTTP 206 Partial Content" response
if req.status_code == 206:
return req.content
else:
print("ENCRYPT: " + repr(req))
print(repr(req.headers))
print(repr(req.text))
raise SystemExit