Skip to content

Commit 0a7e19a

Browse files
author
vadym1226
committed
Merge pull request #35 from mbohlool/master
Fix exec command parameter expansion
2 parents 2132879 + 83ebea7 commit 0a7e19a

File tree

1 file changed

+8
-19
lines changed

1 file changed

+8
-19
lines changed

stream/ws_client.py

+8-19
Original file line numberDiff line numberDiff line change
@@ -229,33 +229,22 @@ def websocket_call(configuration, *args, **kwargs):
229229
apiClient.request method."""
230230

231231
url = args[1]
232-
query_params = kwargs.get("query_params", {})
233232
_request_timeout = kwargs.get("_request_timeout", 60)
234233
_preload_content = kwargs.get("_preload_content", True)
235234
headers = kwargs.get("headers")
236235

237-
# Extract the command from the list of tuples
238-
commands = None
239-
for key, value in query_params:
240-
if key == 'command':
241-
commands = value
242-
break
243-
244-
# drop command from query_params as we will be processing it separately
245-
query_params = [(key, value) for key, value in query_params if
246-
key != 'command']
236+
# Expand command parameter list to indivitual command params
237+
query_params = []
238+
for key, value in kwargs.get("query_params", {}):
239+
if key == 'command' and isinstance(value, list):
240+
for command in value:
241+
query_params.append((key, command))
242+
else:
243+
query_params.append((key, value))
247244

248-
# if we still have query params then encode them
249245
if query_params:
250246
url += '?' + urlencode(query_params)
251247

252-
# tack on the actual command to execute at the end
253-
if isinstance(commands, list):
254-
for command in commands:
255-
url += "&command=%s&" % quote_plus(command)
256-
elif commands is not None:
257-
url += '&command=' + quote_plus(commands)
258-
259248
try:
260249
client = WSClient(configuration, get_websocket_url(url), headers)
261250
if not _preload_content:

0 commit comments

Comments
 (0)