MCPcopy Create free account
hub / github.com/Keeper-Security/Commander / v2_execute

Function v2_execute

keepercommander/rest_api.py:309–325  ·  view source on GitHub ↗
(context, rq)

Source from the content-addressed store, hash-verified

307
308
309def v2_execute(context, rq):
310 # type: (RestApiContext, dict) -> Optional[dict]
311
312 api_request_payload = proto.ApiRequestPayload()
313 api_request_payload.payload = json.dumps(rq).encode('utf-8')
314 rs_data = execute_rest(context, 'vault/execute_v2_command', api_request_payload)
315 if rs_data:
316 if type(rs_data) is bytes:
317 rs = json.loads(rs_data.decode('utf-8'))
318 logger = logging.getLogger()
319 if logger.level <= logging.DEBUG:
320 logger.debug('>>> Request JSON: [%s]', json.dumps(rq, sort_keys=True, indent=4))
321 logger.debug('<<< Response JSON: [%s]', json.dumps(rs, sort_keys=True, indent=4))
322 return rs
323
324 if type(rs_data) is dict:
325 raise KeeperApiError(rs_data['error'], rs_data['message'])

Callers

nothing calls this directly

Calls 3

execute_restFunction · 0.85
KeeperApiErrorClass · 0.85
debugMethod · 0.45

Tested by

no test coverage detected