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)
| 568 | |
| 569 | |
| 570 | def 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 | |
| 595 | def portforward_call(configuration, _method, url, **kwargs): |
nothing calls this directly
no test coverage detected