add resource check

incorrect pass / hw handling in a loader
This commit is contained in:
Alex Bezdieniezhnykh
2025-06-15 15:01:55 +03:00
parent c0f8dd792d
commit def7aad833
14 changed files with 193 additions and 16 deletions
+8 -3
View File
@@ -47,10 +47,10 @@ cdef class ApiClient:
token = response.json()["token"]
self.set_token(token)
except HTTPError as e:
constants.logerror(response.json())
res = response.json()
constants.logerror(str(res))
if response.status_code == HTTPStatus.CONFLICT:
res = response.json()
raise Exception(res['Message'])
raise Exception(f"Error {res['ErrorCode']}: {res['Message']}")
cdef set_token(self, str token):
@@ -104,6 +104,11 @@ cdef class ApiClient:
constants.log(<str> f'Get files list by {folder}')
return response.json()
cdef check_resource(self):
cdef str hardware = HardwareService.get_hardware_info()
payload = json.dumps({ "hardware": hardware }, indent=4)
response = self.request('post', f'{self.api_url}/resources/check', payload, is_stream=False)
cdef load_bytes(self, str filename, str folder):
cdef str hardware = HardwareService.get_hardware_info()
hw_hash = Security.get_hw_hash(hardware)