mirror of
https://github.com/azaion/annotations.git
synced 2026-04-22 15:06:29 +00:00
add resource check
incorrect pass / hw handling in a loader
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user