twisted.protocols.ftpView Source (View In Hierarchy)
Each command method returns a
is called back when a successful response code (2xx or 3xx) is received
from the server or which is error backed if an error response code (4xx or
5xx) is received from the server or if a protocol violation occurs. If an
error response code is received, the
instance is created with a list of the response lines received from the
See RFC 959 for error code definitions.
Both active and passive transfers are supported.
|Instance Variable||passive||See description in __init__.|
|Method||fail||Disconnect, and also give an error to any queued deferreds.|
|Method||receiveFromConnection||Retrieves a file or listing generated by the given command, feeding it to the given protocol.|
|Method||queueLogin||Login: send the username, send the password, and set retrieval mode to binary|
|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||rename||Rename a file.|
|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.|
|Method||makeDirectory||Make a directory|
|Method||removeFile||Delete a file on the server.|
|Method||removeDirectory||Delete a directory on the server.|
|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.|
|Method||_openDataConnection||This method returns a DeferredList.|
Inherited from FTPClientBasic:
|Method||sendLine||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.|
|Method||_fail||Errback all queued deferreds.|
|Class Variable||delimiter||The line-ending delimiter to use. By default this is
|Class Variable||MAX_LENGTH||The maximum length of a line to allow (If a sent line is longer than this, the connection is dropped). Default is 16384.|
|Method||clearLineBuffer||Clear buffered data.|
|Method||dataReceived||Protocol.dataReceived. Translates bytes into lines, and calls lineReceived (or rawDataReceived, depending on mode.)|
|Method||setLineMode||Sets the line-mode of this receiver.|
|Method||setRawMode||Sets the raw mode of this receiver. Further data received will be sent to rawDataReceived rather than lineReceived.|
|Method||rawDataReceived||Override this for when raw data is received.|
|Method||lineLengthExceeded||Called when the maximum line length has been reached. Override if it needs to be dealt with in some special way.|
|Method||logPrefix||Return a prefix matching the class name, to identify log messages related to this protocol instance.|
|Method||makeConnection||Make a connection to a transport and a server.|
|Method||connectionMade||Called when a connection is made.|
I will login as soon as I receive the welcome message from the server.
|passive||flag that controls if I use active or passive data connections. You can
also change this after construction by assigning to
Disconnect, and also give an error to any queued deferreds.
Retrieves a file or listing generated by the given command, feeding it to the given protocol.
|Parameters||commands||list of strings of FTP commands to execute then receive the results of
Login: send the username, send the password, and set retrieval mode to binary
This method returns a DeferredList.
(Private) Generates the text of a given PORT command.
Returns a FTP escaped path (replace newlines with nulls).
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.|
|offset||offset to start downloading from|
Rename a file.
This method issues the RNFR/RNTO command sequence to
|Parameters||pathFrom: the absolute path to the file to be renamed|
|pathTo: the absolute path to rename the file to.|
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.|
Issues the CWD (Change Working Directory) command.
Make a directory
This method issues the MKD command.
|Parameters||path||The path to the directory to create. (type: |
Delete a file on the server.
issues a DELE command to the server to remove the indicated file.
Note that this command cannot remove a directory.
|Parameters||path||The path to the file to delete. May be relative to the current dir. (type: |
Delete a directory on the server.
issues a RMD command to the server to remove the indicated
directory. Described in RFC959.
|Parameters||path||The path to the directory to delete. May be relative to the current working
directory. (type: |
Issues the CDUP (Change Directory UP) command.