Supports active and passive transfers.
Methods
|
|
|
|
__init__
|
__init__ (
self,
username='anonymous',
password='twisted@twistedmatrix.com',
passive=1,
)
Constructor.
Optional arguments:
username
password
* passive -- flag that control if the client is to use active or
passive data connections. You can also change this after
construction by assigning to self.passive.
I will login as soon as I receive the welcome message from the server.
|
|
cdup
|
cdup ( self )
Issues the CDUP (Change Directory UP) command.
Returns a Deferred that will be called when done.
|
|
cwd
|
cwd ( self, path )
Issues the CWD (Change Working Directory) command.
Returns a Deferred that will be called when done.
|
|
escapePath
|
escapePath ( self, path )
Returns a FTP escaped path (replace newlines with nulls)
|
|
fail
|
fail ( self, error )
Disconnect, and also give an error to any queued deferreds.
|
|
generatePortCommand
|
generatePortCommand ( self, portCmd )
(Private) Generates the text of a given PORT command
|
|
lineReceived
|
lineReceived ( self, line )
(Private) Parses the response messages from the FTP server.
|
|
list
|
list (
self,
path,
protocol,
)
Retrieve a file listing into the given protocol instance.
This method issues the LIST FTP command.
You probably want to use an instance of FTPFileListingProtocol for the
protocol argument, because it should be able to cope with most common
file listing formats.
|
|
nlst
|
nlst (
self,
path,
protocol,
)
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.
|
|
popCommandQueue
|
popCommandQueue ( self )
Return the front element of the command queue, or None if empty.
|
|
pwd
|
pwd ( self )
Issues the PWD (Print Working Directory) command.
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.
|
|
queueCommand
|
queueCommand ( self, ftpCommand )
Add an FTPCommand object to the queue.
If it's the only thing in the queue, and we are connected and we aren't
waiting for a response of an earlier command, the command will be sent
immediately.
|
|
queueLogin
|
queueLogin ( self )
Initialise the connection.
Login, send the password, set retrieval mode to binary
|
|
queueStringCommand
|
queueStringCommand ( self, command )
Queues a string to be issued as an FTP command
Returns a Deferred that will be called when the response to the command
has been received.
|
|
quit
|
quit ( self )
Issues the QUIT command.
|
|
retrieve
|
retrieve (
self,
command,
protocol,
)
Retrieves a file or listing generated by the given command,
feeding it to the given protocol. Returns a Deferred, which should be armed by the caller to ensure that
the connection terminates properly.
|
|
retrieveFile
|
retrieveFile (
self,
path,
protocol,
)
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.
|
|
sendLine
|
sendLine ( self, line )
(Private) Sends a line, unless line is None.
|
|
sendNextCommand
|
sendNextCommand ( self )
(Private) Processes the next command in the queue.
|