MCPcopy Index your code
hub / github.com/kubernetes-client/python / write_channel

Method write_channel

kubernetes/base/stream/ws_client.py:132–143  ·  view source on GitHub ↗

Write data to a channel.

(self, channel, data)

Source from the content-addressed store, hash-verified

130 self.update(timeout=(timeout - time.time() + start))
131
132 def write_channel(self, channel, data):
133 """Write data to a channel."""
134 # check if we're writing binary data or not
135 binary = type(data) == bytes
136 opcode = ABNF.OPCODE_BINARY if binary else ABNF.OPCODE_TEXT
137
138 channel_prefix = chr(channel)
139 if binary:
140 channel_prefix = bytes(channel_prefix, "ascii")
141
142 payload = channel_prefix + data
143 self.sock.send(payload, opcode=opcode)
144
145 def close_channel(self, channel):
146 """Close a channel (v5 protocol only)."""

Callers 1

write_stdinMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected