(url, query_params=None)
| 487 | |
| 488 | |
| 489 | def get_websocket_url(url, query_params=None): |
| 490 | parsed_url = urlparse(url) |
| 491 | parts = list(parsed_url) |
| 492 | if parsed_url.scheme == 'http': |
| 493 | parts[0] = 'ws' |
| 494 | elif parsed_url.scheme == 'https': |
| 495 | parts[0] = 'wss' |
| 496 | if query_params: |
| 497 | query = [] |
| 498 | for key, value in query_params: |
| 499 | if key == 'command' and isinstance(value, list): |
| 500 | for command in value: |
| 501 | query.append((key, command)) |
| 502 | else: |
| 503 | query.append((key, value)) |
| 504 | if query: |
| 505 | parts[4] = urlencode(query) |
| 506 | return urlunparse(parts) |
| 507 | |
| 508 | |
| 509 | def create_websocket(configuration, url, headers=None): |
no outgoing calls