(resp)
return host, port
Parse the '227' response for a PASV request.
    Raises error_proto if it does not contain '(h1,h2,h3,h4,p1,p2)'
    Return ('host.addr.as.numbers', port#) tuple.
Parse the '227' response for a PASV request.
    Raises error_proto if it does not contain '(h1,h2,h3,h4,p1,p2)'
    Return ('host.addr.as.numbers', port#) tuple.
Parse the 227 response for a PASV request . Raises error_proto if it does not contain ( h1 h2 h3 h4 p1 p2 ) Return ( host . addr . as . numbers port# ) tuple .
def parse227(resp):
    '''Parse the '227' response for a PASV request.
    Raises error_proto if it does not contain '(h1,h2,h3,h4,p1,p2)'
    Return ('host.addr.as.numbers', port#) tuple.'''
    if resp[:3] != '227':
        raise error_reply(resp)
    global _227_re
    if _227_re is None:
        import re
        _227_re = re.compile(r'(\d+),(\d+),(\d+),(\d+),(\d+),(\d+)', re.ASCII)
    m = _227_re.search(resp)
    if not m:
        raise error_proto(resp)
    numbers = m.groups()
    host = '.'.join(numbers[:4])
    port = (int(numbers[4]) << 8) + int(numbers[5])
    return host, port
def parse227 ( resp ) : if resp [ : 3 ] != '227' : raise error_reply ( resp ) global _227_re if _227_re is None : import re _227_re = re . compile ( r'(\d+),(\d+),(\d+),(\d+),(\d+),(\d+)' , re . ASCII ) m = _227_re . search ( resp ) if not m : raise error_proto ( resp ) numbers = m . groups ( ) host = '.' . join ( numbers [ : 4 ] ) port = ( int ( numbers [ 4 ] ) << 8 ) + int ( numbers [ 5 ] ) return host , port