Several methods are available in two flavors: one for handling textfiles and another for binary files. These are named for the commandwhich is used followed by "lines" for the text version or"binary" for the binary version.
FTP instances have the following methods:
| level) |
0, produces nodebugging output. A value of1 produces a moderate amount ofdebugging output, generally a single line per request. A value of2 or higher produces the maximum amount of debugging output,logging each line sent and received on the control connection.| host[, port]) |
21, asspecified by the FTP protocol specification. It is rarely needed tospecify a different port number. This function should be called onlyonce for each instance; it should not be called at all if a host wasgiven when the instance was created. All other methods can only beused after a connection has been made.| ) |
| [user[, passwd[, acct]]]) |
'anonymous'. Ifuser is'anonymous', the defaultpasswd is'anonymous@'. This function should be called onlyonce for each instance, after a connection has been established; itshould not be called at all if a host and user were given when theinstance was created. Most FTP commands are only allowed after theclient has logged in.| ) |
| command) |
| command) |
| command, callback[, maxblocksize[, rest]]) |
'RETRfilename'.Thecallback function is called for each block of data received,with a single string argument giving the data block.The optionalmaxblocksize argument specifies the maximum chunk size toread on the low-level socket object created to do the actual transfer(which will also be the largest size of the data blocks passed tocallback). A reasonable default is chosen.rest means thesame thing as in thetransfercmd() method.| command[, callback]) |
'LIST'). Thecallback function is called for each line,with the trailing CRLF stripped. The defaultcallback printsthe line tosys.stdout.| boolean) |
| command, file[, blocksize]) |
"STORfilename".file is an open file object which is read until EOF using itsread() method in blocks of sizeblocksize to provide thedata to be stored. Theblocksize argument defaults to 8192.Changed in version 2.1:default forblocksize added.| command, file) |
| cmd[, rest]) |
If optionalrest is given, a "REST" command issent to the server, passingrest as an argument.rest isusually a byte offset into the requested file, telling the server torestart sending the file's bytes at the requested offset, skippingover the initial bytes. Note however that RFC959 requires only thatrest be a string containing charactersin the printable range from ASCII code 33 to ASCII code 126. Thetransfercmd() method, therefore, convertsrest to a string, but no check isperformed on the string's contents. If the server doesnot recognize the "REST" command, anerror_reply exception will be raised. If this happens,simply calltransfercmd() without arest argument.
| cmd[, rest]) |
None will be returned as the expectedsize.cmd andrest means the same thing as intransfercmd().| argument[, ...]) |
| argument[, ...]) |
sys.stdout. This method returnsNone.| fromname, toname) |
| filename) |
| pathname) |
| pathname) |
| ) |
| dirname) |
| filename) |
None is returned. Note that the "SIZE" command is not standardized, but is supported by many common server implementations.| ) |
| ) |