Skip to content

Commit d305242

Browse files
committed
resolves #9 : pass custom options (ie: read timeout) to send_command
1 parent fd84bfd commit d305242

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

stormshield/sns/sslclient/__init__.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,7 @@ def nws_parse(self, code):
483483
else:
484484
raise ServerError("Unknown error")
485485

486-
def send_command(self, command):
486+
def send_command(self, command, **conn_options):
487487
"""Execute a NSRPC command on the remote appliance.
488488
489489
:param command: SNS API command. Files can be uploaded by adding '< filename'
@@ -492,6 +492,11 @@ def send_command(self, command):
492492
:rtype: stormshield.sns.Response
493493
"""
494494

495+
# overload connection options
496+
for k in self.conn_options:
497+
if k not in conn_options:
498+
conn_options[k] = self.conn_options[k]
499+
495500
filename = None
496501
result = self.fileregexp.match(command)
497502
if result:
@@ -501,7 +506,7 @@ def send_command(self, command):
501506
request = self.session.get(
502507
self.baseurl + '/api/command?sessionid=' + self.sessionid +
503508
'&cmd=' + requests.compat.quote(command.encode('utf-8')), # manually done since we need %20 encoding
504-
headers=self.headers, **self.conn_options)
509+
headers=self.headers, **conn_options)
505510

506511
self.logger.log(logging.DEBUG, request.text)
507512

0 commit comments

Comments
 (0)