python implementation of NETANTS ?

C.S. Xu cxu1 at china.com
Mon Sep 24 07:30:30 EDT 2001


Thank you very much. It's true that no "rest" option in Python 1.5.2
library
reference, ;-)

Now I've composed a simple python script: pyget. For example, to
download the second fourth part of aFile from ftp.someDomain, I can
use:
	pyftp --part 2/4 ftp://ftp.someDomain/aFile

Then I can download every part at the same time, when they're all
done, I
can just `cat` them together.

I've put this short script at:
	http://xucs.tripod.com/soft/pyftp

It can also continue an interrupted downloading.

Thanks again.

 

> see
> 
> 11.6.1 FTP Objects
> 
> retrbinary(command, callback[, maxblocksize[, rest]])
> Retrieve a file in binary transfer mode. command should be an appropriate
> "RETR" command, i.e. 'RETR filename'. The callback function is called for
> each block of data received, with a single string argument giving the data
> block. The optional maxblocksize argument specifies the maximum chunk size
> to read on the low-level socket object created to do the actual transfer
> (which will also be the largest size of the data blocks passed to callback).
> A reasonable default is chosen. rest means the same thing as in the
> transfercmd() method.
> 
> transfercmd(cmd[, rest])
> Initiate a transfer over the data connection. If the transfer is active,
> send a "PORT" command and the transfer command specified by cmd, and accept
> the connection. If the server is passive, send a "PASV" command, connect to
> it, and start the transfer command. Either way, return the socket for the
> connection.
> If optional rest is given, a "REST" command is sent to the server, passing
> rest as an argument. rest is usually a byte offset into the requested file,
> telling the server to restart sending the file's bytes at the requested
> offset, skipping over the initial bytes. Note however that RFC 959 requires
> only that rest be a string containing characters in the printable range from
> ASCII code 33 to ASCII code 126. The transfercmd() method, therefore,
> converts rest to a string, but no check is performed on the string's
> contents. If the server does not recognize the "REST" command, an
> error_reply exception will be raised. If this happens, simply call
> transfercmd() without a rest argument.
> 
> and remember not all servers will allow multiple threads
> 
> Tom



More information about the Python-list mailing list