Part of twisted.protocols.ftp View Source View In Hierarchy
A Twisted FTP Client
Supports active and passive transfers.
This class is semi-stable.Instance Variables | passive | See description in __init__. |
Method | __init__ | Constructor. |
Method | fail | Disconnect, and also give an error to any queued deferreds. |
Method | receiveFromConnection | Retrieves a file or listing generated by the given command, |
Method | queueLogin | Login: send the username, send the password, and |
Method | sendToConnection | XXX |
Method | _openDataConnection | This method returns a DeferredList. |
Method | generatePortCommand | (Private) Generates the text of a given PORT command. |
Method | escapePath | Returns a FTP escaped path (replace newlines with nulls). |
Method | retrieveFile | Retrieve a file from the given path |
Method | storeFile | Store a file at the given path. |
Method | list | Retrieve a file listing into the given protocol instance. |
Method | nlst | Retrieve a short file listing into the given protocol instance. |
Method | cwd | Issues the CWD (Change Working Directory) command. It's also |
Method | changeDirectory | Change the directory on the server and parse the result to determine |
Method | cdup | Issues the CDUP (Change Directory UP) command. |
Method | pwd | Issues the PWD (Print Working Directory) command. |
Method | getDirectory | Returns the current remote directory. |
Method | quit | Issues the QUIT command. |
Inherited from FTPClientBasic:
Method | _fail | Errback all queued deferreds. |
Method | _cb_greeting | Undocumented |
Method | sendLine | (Private) Sends a line, unless line is None. |
Method | sendNextCommand | (Private) Processes the next command in the queue. |
Method | queueCommand | Add an FTPCommand object to the queue. |
Method | queueStringCommand | Queues a string to be issued as an FTP command |
Method | popCommandQueue | Return the front element of the command queue, or None if empty. |
Method | lineReceived | (Private) Parses the response messages from the FTP server. |
Method | connectionLost | Called when the connection is shut down. |
Inherited from LineReceiver (via FTPClientBasic):
Method | clearLineBuffer | Clear buffered data. |
Method | dataReceived | Protocol.dataReceived. |
Method | setLineMode | Sets the line-mode of this receiver. |
Method | setRawMode | Sets the raw mode of this receiver. |
Method | rawDataReceived | Override this for when raw data is received. |
Method | lineLengthExceeded | Called when the maximum line length has been reached. |
Inherited from BaseProtocol (via FTPClientBasic, LineReceiver, Protocol):
Method | makeConnection | Make a connection to a transport and a server. |
Method | connectionMade | Called when a connection is made. |
Inherited from _PauseableMixin (via FTPClientBasic, LineReceiver):
Method | pauseProducing | Undocumented |
Method | resumeProducing | Undocumented |
Method | stopProducing | Undocumented |
Constructor.
I will login as soon as I receive the welcome message from the server.Parameters | username | FTP username |
password | FTP password | |
passive | flag that controls if I use active or passive data connections. You can also change this after construction by assigning to self.passive. |
Parameters | command | list of strings of FTP commands to execute then receive the results of (e.g. LIST, RETR) |
protocol | A Protocol
*instance* e.g. an FTPFileListProtocol ,
or something that can be adapted to one. Typically this will be an IConsumer
implemenation.
| |
Returns | Deferred .
|
Returns | A tuple of two Deferred s:
|
Retrieve a file from the given path
This method issues the 'RETR' FTP command.
The file is fed into the given Protocol instance. The data connection will be passive if self.passive is set.Parameters | path | path to file that you wish to receive. |
protocol | a Protocol
instance.
| |
offset | offset to start downloading from | |
Returns | Deferred
|
Store a file at the given path.
This method issues the 'STOR' FTP command.Returns | A tuple of two Deferred s:
|
Retrieve a file listing into the given protocol instance.
This method issues the 'LIST' FTP command.Parameters | path | path to get a file listing for. |
protocol | a Protocol
instance, probably a FTPFileListProtocol
instance. It can cope with most common file listing formats.
| |
Returns | Deferred
|
Retrieve a short file listing into the given protocol instance.
This method issues the 'NLST' FTP command.
NLST (should) return a list of filenames, one per line.Parameters | path | path to get short file listing for. |
protocol | a Protocol
instance.
|
Returns | a Deferred
that will be called when done.
|
Parameters | path | The path to which to change.
(type: str
) |
Returns | a Deferred
which will be called back when the directory change has succeeded or and
errbacked if an error occurrs.
|
Returns | a Deferred
that will be called when done.
|
Issues the PWD (Print Working Directory) command.
ThegetDirectory
does the same job but automatically parses the result.
Returns | a Deferred
that will be called when done. It is up to the caller to interpret the
response, but the parsePWDResponse
method in this module should work.
|
Returns | a Deferred
that will be called back with a str giving the remote
directory or which will errback with CommandFailed
if an error response is returned.
|