Did I find the right examples for you? yes no

All Samples(7)  |  Call(5)  |  Derive(0)  |  Import(2)
Convert an host:port string into (host, port) tuple.

        def address_to_tuple(addr):
    """
    Convert an host:port string into (host, port) tuple.
    """
    addr = str(addr)
    address, port = None, None
    if ":" in addr:
        address, port = addr.split(":")[0], int(addr.split(":")[1])
    elif addr.isdigit():
        port = int(addr)
    else:
        address = addr
    return address, port
        


src/w/s/wstunnel-0.0.3/wstunnel/factory.py   wstunnel(Download)
from wstunnel.client import WSTunnelClient, WebSocketProxy
from wstunnel.server import WSTunnelServer
from wstunnel.toolbox import address_to_tuple
 
__author__ = 'fabio'
def create_ws_server_endpoint(config):
    """
    Create a server endpoint parsing the configuration file options
    """
    address, port = address_to_tuple(config["listen"])
 
        srv.add_proxy(key=resource,
                      ws_proxy={"address": address_to_tuple(settings["address"]),
                                "filters": filters})
    return srv

src/w/s/wstunnel-0.0.3/wstunnel/test/test_toolbox.py   wstunnel(Download)
from wstunnel.factory import load_filter
from wstunnel.filters import DumpFilter
from wstunnel.toolbox import address_to_tuple, tuple_to_address, hex_dump, random_free_port
 
__author__ = 'fabio'
        """
        addr = "127.0.0.1:443"
        t = address_to_tuple(addr)
        self.assertEqual(t, ("127.0.0.1", 443))
        self.assertEqual(addr, tuple_to_address(t))
        """
        addr = "127.0.0.1"
        t = address_to_tuple(addr)
        self.assertEqual(t, ("127.0.0.1", None))
        self.assertEqual(addr, tuple_to_address(t))
        """
        addr = 443
        t = address_to_tuple(addr)
        self.assertEqual(t, (None, 443))
        self.assertEqual(addr, tuple_to_address(t))