Trees | Indices | Help |
|
---|
|
An FTP client class. To create a connection, call the class using these argument: host, user, passwd, acct These are all strings, and have default value ''. Then use self.connect() with optional host and port argument. To download a file, use ftp.retrlines('RETR ' + filename), or ftp.retrbinary() with slightly different arguments. To upload a file, use ftp.storlines() or ftp.storbinary(), which have an open file as argument (see their definitions below for details). The download/upload functions first issue appropriate TYPE and PORT or PASV commands.
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|
|||
debugging = 0
|
|||
host =
|
|||
port = 21
|
|||
sock = None
|
|||
file = None
|
|||
welcome = None
|
|||
passiveserver = 1
|
|
Connect to host. Arguments are:
|
Get the welcome message from the server. (this is read and squirreled away by connect()) |
Set the debugging level. The required argument level means: 0: no debugging output (default) 1: print commands and responses but not body text etc. 2: also print raw lines read and sent before stripping CR/LF |
Set the debugging level. The required argument level means: 0: no debugging output (default) 1: print commands and responses but not body text etc. 2: also print raw lines read and sent before stripping CR/LF |
Use passive or active mode for data transfers. With a false argument, use the normal PORT mode, With a true argument, use the PASV command. |
Abort a file transfer. Uses out-of-band data. This does not follow the procedure from the RFC to send Telnet IP and Synch; that doesn't seem to work with the servers I've tried. Instead, just send the ABOR command as OOB data. |
Initiate a transfer over the data connection. If the transfer is active, send a port command and the transfer command, 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 and the expected size of the transfer. The expected size may be None if it could not be determined. Optional `rest' argument can be a string that is sent as the argument to a RESTART command. This is essentially a server marker used to tell the server to skip over any data up to the given marker. |
Retrieve data in binary mode. `cmd' is a RETR command. `callback' is a callback function is called for each block. No more than `blocksize' number of bytes will be read from the socket. Optional `rest' is passed to transfercmd(). A new port is created for you. Return the response code. |
Retrieve data in line mode. The argument is a RETR or LIST command. The callback function (2nd argument) is called for each line, with trailing CRLF stripped. This creates a new port for you. print_line() is the default callback. |
List a directory in long form. By default list current directory to stdout. Optional last argument is callback function; all non-empty arguments before it are concatenated to the LIST command. (This *should* only be used for a pathname.) |
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0 on Tue Jan 29 22:43:41 2008 | http://epydoc.sourceforge.net |