examples/utils.py
def get_host_port(server_address):
    """Parse the hostname and port out of the server_address."""
    regex = re.compile(r"^amqp://([a-zA-Z0-9.]+)(:([\d]+))?$")
    x = regex.match(server_address)
    if not x:
        raise Exception("Bad address syntax: %s" % server_address)
    matches = x.groups()
    host = matches[0]
    port = int(matches[2]) if matches[2] else None
    return host, port
def get_host_port(server_address):
    """Parse the hostname and port out of the server_address."""
    regex = re.compile(r"^amqp://([a-zA-Z0-9.]+)(:([\d]+))?$")
    x = regex.match(server_address)
    if not x:
        raise Exception("Bad address syntax: %s" % server_address)
    matches = x.groups()
    host = matches[0]
    port = int(matches[2]) if matches[2] else None
    return host, port
def get_host_port ( server_address ) : regex = re . compile ( r"^amqp://([a-zA-Z0-9.]+)(:([\d]+))?$" ) x = regex . match ( server_address ) if not x : raise Exception ( "Bad address syntax: %s" % server_address ) matches = x . groups ( ) host = matches [ 0 ] port = int ( matches [ 2 ] ) if matches [ 2 ] else None return host , port
Parse the hostname and port out of the server_address.
Parse the hostname and port out of the server_address .