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

Function websocket_call

kubernetes/base/stream/ws_client.py:570–592  ·  view source on GitHub ↗

An internal function to be called in api-client when a websocket connection is required. method, url, and kwargs are the parameters of apiClient.request method.

(configuration, _method, url, **kwargs)

Source from the content-addressed store, hash-verified

568
569
570def websocket_call(configuration, _method, url, **kwargs):
571 """An internal function to be called in api-client when a websocket
572 connection is required. method, url, and kwargs are the parameters of
573 apiClient.request method."""
574
575 url = get_websocket_url(url, kwargs.get("query_params"))
576 headers = kwargs.get("headers")
577 _request_timeout = kwargs.get("_request_timeout", 60)
578 _preload_content = kwargs.get("_preload_content", True)
579 capture_all = kwargs.get("capture_all", True)
580 binary = kwargs.get('binary', False)
581 try:
582 client = WSClient(configuration, url, headers, capture_all, binary=binary)
583 if not _preload_content:
584 return client
585 client.run_forever(timeout=_request_timeout)
586 all = client.read_all()
587 if binary:
588 return WSResponse(data=all, status=200)
589 else:
590 return WSResponse(data='%s' % ''.join(all), status=200)
591 except (Exception, KeyboardInterrupt, SystemExit) as e:
592 raise ApiException(status=0, reason=str(e))
593
594
595def portforward_call(configuration, _method, url, **kwargs):

Callers

nothing calls this directly

Calls 7

run_foreverMethod · 0.95
read_allMethod · 0.95
get_websocket_urlFunction · 0.85
WSClientClass · 0.85
WSResponseClass · 0.85
ApiExceptionClass · 0.50
getMethod · 0.45

Tested by

no test coverage detected