(self, match, timeout=None)
return self.read_very_lazy()
Read until a given string is encountered or until timeout.

        When no match is found, return whatever is available instead,
        possibly the empty string.  Raise EOFError if the connection
        is closed and no cooked data is available.
Read until a given string is encountered or until timeout.
Read until a given string is encountered or until timeout .
def read_until(self, match, timeout=None):
        """Read until a given string is encountered or until timeout.

        When no match is found, return whatever is available instead,
        possibly the empty string.  Raise EOFError if the connection
        is closed and no cooked data is available.

        """
        n = len(match)
        self.process_rawq()
        i = self.cookedq.find(match)
        if i >= 0:
            i = i+n
            buf = self.cookedq[:i]
            self.cookedq = self.cookedq[i:]
            return buf
        if timeout is not None:
            deadline = _time() + timeout
        with _TelnetSelector() as selector:
            selector.register(self, selectors.EVENT_READ)
            while not self.eof:
                if selector.select(timeout):
                    i = max(0, len(self.cookedq)-n)
                    self.fill_rawq()
                    self.process_rawq()
                    i = self.cookedq.find(match, i)
                    if i >= 0:
                        i = i+n
                        buf = self.cookedq[:i]
                        self.cookedq = self.cookedq[i:]
                        return buf
                if timeout is not None:
                    timeout = deadline - _time()
                    if timeout < 0:
                        break
        return self.read_very_lazy()
def read_until ( self , match , timeout = None ) : n = len ( match ) self . process_rawq ( ) i = self . cookedq . find ( match ) if i >= 0 : i = i + n buf = self . cookedq [ : i ] self . cookedq = self . cookedq [ i : ] return buf if timeout is not None : deadline = _time ( ) + timeout with _TelnetSelector ( ) as selector : selector . register ( self , selectors . EVENT_READ ) while not self . eof : if selector . select ( timeout ) : i = max ( 0 , len ( self . cookedq ) - n ) self . fill_rawq ( ) self . process_rawq ( ) i = self . cookedq . find ( match , i ) if i >= 0 : i = i + n buf = self . cookedq [ : i ] self . cookedq = self . cookedq [ i : ] return buf if timeout is not None : timeout = deadline - _time ( ) if timeout < 0 : break return self . read_very_lazy ( )