websocket/_url.py

The _url.py file

websocket._url.get_proxy_info(hostname, is_secure, proxy_host=None, proxy_port=0, proxy_auth=None, no_proxy=None, proxy_type='http')[source]

Try to retrieve proxy host and port from environment if not provided in options. Result is (proxy_host, proxy_port, proxy_auth). proxy_auth is tuple of username and password of proxy authentication information.

Parameters
  • hostname (str) – Websocket server name.

  • is_secure (bool) – Is the connection secure? (wss) looks for “https_proxy” in env before falling back to “http_proxy”

  • proxy_host (str) – http proxy host name.

  • http_proxy_port (str or int) – http proxy port.

  • http_no_proxy (list) – Whitelisted host names that don’t use the proxy.

  • http_proxy_auth (tuple) – HTTP proxy auth information. Tuple of username and password. Default is None.

  • proxy_type (str) – If set to “socks4” or “socks5”, a PySocks wrapper will be used in place of a HTTP proxy. Default is “http”.

websocket._url.parse_url(url)[source]

parse url and the result is tuple of (hostname, port, resource path and the flag of secure mode)

Parameters

url (str) – url string.