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 (<type>) – websocket server name.

  • is_secure (<type>) – is the connection secure? (wss) looks for “https_proxy” in env before falling back to “http_proxy”

  • options (<type>) –

    • http_proxy_host: <type>

      http proxy host name.

    • http_proxy_port: <type>

      http proxy port.

    • http_no_proxy: <type>

      host names, which doesn’t use proxy.

    • http_proxy_auth: <type>

      http proxy auth information. tuple of username and password. default is None

    • proxy_type: <type>

      if set to “socks5” 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.