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

Function v2_execute

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

Source from the content-addressed store, hash-verified

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