Logo Search packages:      
Sourcecode: s3ql version File versions  Download package

def s3ql::backends::ftplib::FTP::retrlines (   self,
  cmd,
  callback = None 
)
Retrieve data in line mode.  A new port is created for you.

Args:
  cmd: A RETR, LIST, NLST, or MLSD command.
  callback: An optional single parameter callable that is called
    for each line with the trailing CRLF stripped.
    [default: print_line()]

Returns:
  The response code.

Reimplemented in s3ql::backends::ftplib::FTP_TLS.

Definition at line 411 of file ftplib.py.

                                           :
        """Retrieve data in line mode.  A new port is created for you.

        Args:
          cmd: A RETR, LIST, NLST, or MLSD command.
          callback: An optional single parameter callable that is called
                    for each line with the trailing CRLF stripped.
                    [default: print_line()]

        Returns:
          The response code.
        """
        if callback is None: callback = print_line
        resp = self.sendcmd('TYPE A')
        conn = self.transfercmd(cmd)
        fp = conn.makefile('rb')
        while 1:
            line = fp.readline()
            if self.debugging > 2: print '*retr*', repr(line)
            if not line:
                break
            if line[-2:] == CRLF:
                line = line[:-2]
            elif line[-1:] == '\n':
                line = line[:-1]
            callback(line)
        fp.close()
        conn.close()
        return self.voidresp()


Generated by  Doxygen 1.6.0   Back to index