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

def s3ql::backends::ftplib::FTP::storbinary (   self,
  cmd,
  fp,
  blocksize = 8192,
  callback = None 
)
Store a file in binary mode.  A new port is created for you.

Args:
  cmd: A STOR command.
  fp: A file-like object with a read(num_bytes) method.
  blocksize: The maximum data size to read from fp and send over
     the connection at once.  [default: 8192]
  callback: An optional single parameter callable that is called on
    on each block of data after it is sent.  [default: None]

Returns:
  The response code.

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

Definition at line 441 of file ftplib.py.

                                                                :
        """Store a file in binary mode.  A new port is created for you.

        Args:
          cmd: A STOR command.
          fp: A file-like object with a read(num_bytes) method.
          blocksize: The maximum data size to read from fp and send over
                     the connection at once.  [default: 8192]
          callback: An optional single parameter callable that is called on
                    on each block of data after it is sent.  [default: None]

        Returns:
          The response code.
        """
        self.voidcmd('TYPE I')
        conn = self.transfercmd(cmd)
        while 1:
            buf = fp.read(blocksize)
            if not buf: break
            conn.sendall(buf)
            if callback: callback(buf)
        conn.close()
        return self.voidresp()


Generated by  Doxygen 1.6.0   Back to index