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

Function v2_execute

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

Source from the content-addressed store, hash-verified

606
607
608def v2_execute(context, rq):
609 # type: (RestApiContext, dict) -> Optional[dict]
610
611 api_request_payload = proto.ApiRequestPayload()
612 api_request_payload.payload = json.dumps(rq).encode('utf-8')
613 rs_data = execute_rest(context, 'vault/execute_v2_command', api_request_payload)
614 if rs_data:
615 if type(rs_data) is bytes:
616 rs = json.loads(rs_data.decode('utf-8'))
617 logger = logging.getLogger()
618 if logger.level <= logging.DEBUG:
619 logger.debug('>>> Request JSON: [%s]', json.dumps(rq, sort_keys=True, indent=4))
620 logger.debug('<<< Response JSON: [%s]', json.dumps(rs, sort_keys=True, indent=4))
621 return rs
622
623 if type(rs_data) is dict:
624 raise KeeperApiError(rs_data['error'], rs_data['message'])

Callers

nothing calls this directly

Calls 4

execute_restFunction · 0.85
KeeperApiErrorClass · 0.85
encodeMethod · 0.45
debugMethod · 0.45

Tested by

no test coverage detected