Description
What is the feature and why do you need it:
I'd like to be able to set capture_all=False
when making a stream(client.connect_get_namespaced_pod_exec, ...)
call. capture_all
is a parameter which your WSClient
initialiser accepts (source).
I sometimes stream large amounts of data over stdout, something like this:
ws_client = stream(
client.connect_get_namespaced_pod_exec,
name="my-pod",
namespace="my-namespace",
command=["cat", "my-file.txt"],
stdin=False,
stdout=True,
stderr=True,
binary=True,
_preload_content=False,
_request_timeout=60,
)
while ws_client.is_open():
ws_client.update(timeout=1)
if ws_client.peek_stdout():
frame = ws_client.read_stdout()
# write frame to file-like object
I want to avoid storing all the stdout in memory at any given point. At present, unless I do ws_client.read_all()
inside my loop, all the stdout+stderr builds up in WSClient._all
.
Describe the solution you'd like to see:
The easiest approach looks to be: adapt the _websocket_request()
function (source) to pop()
capture_all
from kwargs
like is already done with binary
.
Apologies if I'm missing a trick here and thanks for the invaluable library!