Skip to content

Commit

Permalink
Update eapilib.py
Browse files Browse the repository at this point in the history
changed the way EAPI params passed to `jsonrpc`, while preserving currently existing (supported) syntax. This way a user can pass any EAPI parameters into `jsonrpc`
  • Loading branch information
dlyssenko authored Sep 24, 2024
1 parent 2f9cd32 commit 1ced28f
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions pyeapi/eapilib.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,19 +344,14 @@ def request(self, commands, encoding=None, reqid=None, **kwargs):
"""
commands = make_iterable(commands)
reqid = id(self) if reqid is None else reqid
params = {'version': 1, 'cmds': commands, 'format': encoding}
streaming = False
if 'apiVersion' in kwargs:
params['version'] = kwargs['apiVersion']
if 'autoComplete' in kwargs:
params['autoComplete'] = kwargs['autoComplete']
if 'expandAliases' in kwargs:
params['expandAliases'] = kwargs['expandAliases']
if 'streaming' in kwargs:
streaming = kwargs['streaming']
return json.dumps({'jsonrpc': '2.0', 'method': 'runCmds',
streaming = kwargs.pop( 'streaming', False )
params = { 'version': kwargs.pop('apiVersion', 1),
'format': kwargs.pop('format', encoding) }
params.update( kwargs )
params.update({ 'cmds': commands })
return json.dumps( {'jsonrpc': '2.0', 'method': 'runCmds',
'params': params, 'id': str(reqid),
'streaming': streaming})
'streaming': streaming} )

def send(self, data):
"""Sends the eAPI request to the destination node
Expand Down

0 comments on commit 1ced28f

Please sign in to comment.