1 2 3 4 5
from urllib.parse import urlparse def is_ws_url(url: str) -> bool: return urlparse(url).scheme in {"wss", "ws", "http", "https"}