class documentation

class twisted.conch.ssh.filetransfer.FileTransferClient(FileTransferBase): (source)

View In Hierarchy

Undocumented

Method __init__
Instance Variable extData Undocumented
Instance Variable counter Undocumented
Instance Variable openRequests Undocumented
Method connectionMade Called when a connection is made.
Method connectionLost Called when connection to the remote subsystem was lost.
Method openFile Open a file.
Method removeFile Remove the given file.
Method renameFile Rename the given file.
Method makeDirectory Make a directory.
Method removeDirectory Remove a directory (non-recursively)
Method openDirectory Open a directory for scanning.
Method getAttrs Return the attributes for the given path.
Method setAttrs Set the attributes for the path.
Method readLink Find the root of a set of symbolic links.
Method makeLink Create a symbolic link.
Method realPath Convert any path to an absolute path.
Method extendedRequest Make an extended request of the server.
Method packet_VERSION Undocumented
Instance Variable version Undocumented
Method packet_STATUS Undocumented
Method packet_HANDLE Undocumented
Method packet_DATA Undocumented
Method packet_NAME Undocumented
Method packet_ATTRS Undocumented
Method packet_EXTENDED_REPLY Undocumented
Method gotServerVersion Called when the client sends their version info.
Method _sendRequest Send a request and return a deferred which waits for the result.
Method _parseRequest Undocumented
Method _cbOpenHandle Callback invoked when an OPEN or OPENDIR request succeeds.
Method _cbRealPath Undocumented

Inherited from FileTransferBase:

Class Variable versions Undocumented
Class Variable packetTypes Undocumented
Instance Variable buf Undocumented
Instance Variable otherVersion Undocumented
Method sendPacket Undocumented
Method dataReceived Called whenever data is received.
Instance Variable connected Undocumented
Class Variable _log Undocumented
Method _parseAttributes Undocumented
Method _packAttributes Undocumented

Inherited from Protocol (via FileTransferBase):

Class Variable factory Undocumented
Method logPrefix Return a prefix matching the class name, to identify log messages related to this protocol instance.

Inherited from BaseProtocol (via FileTransferBase, Protocol):

Instance Variable transport Undocumented
Method makeConnection Make a connection to a transport and a server.
def __init__(self, extData={}): (source)
ParametersextDataa dict of extended_name : extended_data items to be sent to the server.
extData = (source)

Undocumented

(type: dict)
counter = (source)

Undocumented

(type: int)
openRequests = (source)

Undocumented

(type: dict)
def connectionMade(self): (source)

Called when a connection is made.

This may be considered the initializer of the protocol, because it is called when the connection is completed. For clients, this is called once the connection to the server has been established; for servers, this is called after an accept() call stops blocking and a socket has been received. If you need to send any greeting or initial message, do it here.

def connectionLost(self, reason): (source)

Called when connection to the remote subsystem was lost.

Any pending requests are aborted.

def _sendRequest(self, msg, data): (source)

Send a request and return a deferred which waits for the result.

ParametersmsgThe request type (e.g., FXP_READ). (type: int)
dataThe body of the request. (type: bytes)
def _parseRequest(self, data): (source)

Undocumented

def openFile(self, filename, flags, attrs): (source)

Open a file.

This method returns a Deferred that is called back with an object that provides the ISFTPFile interface.

Parametersfilenamea string representing the file to open. (type: bytes)
flagsan integer of the flags to open the file with, ORed together. The flags and their values are listed at the bottom of this file.
attrsa list of attributes to open the file with. It is a dictionary, consisting of 0 or more keys. The possible keys are:
    size: the size of the file in bytes
    uid: the user ID of the file as an integer
    gid: the group ID of the file as an integer
    permissions: the permissions of the file with as an integer.
    the bit representation of this field is defined by POSIX.
    atime: the access time of the file as seconds since the epoch.
    mtime: the modification time of the file as seconds since the epoch.
    ext_*: extended attributes.  The server is not required to
    understand this, but it may.

NOTE: there is no way to indicate text or binary files. it is up to the SFTP client to deal with this.

def _cbOpenHandle(self, handle, handleClass, name): (source)

Callback invoked when an OPEN or OPENDIR request succeeds.

ParametershandleThe handle returned by the server (type: bytes)
handleClassThe class that will represent the newly-opened file or directory to the user (either ClientFile or ClientDirectory).
nameThe name of the file or directory represented by handle. (type: bytes)
def removeFile(self, filename): (source)

Remove the given file.

This method returns a Deferred that is called back when it succeeds.

Parametersfilenamethe name of the file as a string. (type: bytes)
def renameFile(self, oldpath, newpath): (source)

Rename the given file.

This method returns a Deferred that is called back when it succeeds.

Parametersoldpaththe current location of the file. (type: bytes)
newpaththe new file name. (type: bytes)
def makeDirectory(self, path, attrs): (source)

Make a directory.

This method returns a Deferred that is called back when it is created.

Parameterspaththe name of the directory to create as a string. (type: bytes)
attrsa dictionary of attributes to create the directory with. Its meaning is the same as the attrs in the openFile method.
def removeDirectory(self, path): (source)

Remove a directory (non-recursively)

It is an error to remove a directory that has files or directories in it.

This method returns a Deferred that is called back when it is removed.

Parameterspaththe directory to remove. (type: bytes)
def openDirectory(self, path): (source)

Open a directory for scanning.

This method returns a Deferred that is called back with an iterable object that has a close() method.

The close() method is called when the client is finished reading from the directory. At this point, the iterable will no longer be used.

The iterable returns triples of the form (filename, longname, attrs) or a Deferred that returns the same. The sequence must support __getitem__, but otherwise may be any 'sequence-like' object.

filename is the name of the file relative to the directory. logname is an expanded format of the filename. The recommended format is: -rwxr-xr-x 1 mjos staff 348911 Mar 25 14:29 t-filexfer 1234567890 123 12345678 12345678 12345678 123456789012

The first line is sample output, the second is the length of the field. The fields are: permissions, link count, user owner, group owner, size in bytes, modification time.

attrs is a dictionary in the format of the attrs argument to openFile.

Parameterspaththe directory to open. (type: bytes)
def getAttrs(self, path, followLinks=0): (source)

Return the attributes for the given path.

This method returns a dictionary in the same format as the attrs argument to openFile or a Deferred that is called back with same.

Parameterspaththe path to return attributes for as a string. (type: bytes)
followLinksa boolean. if it is True, follow symbolic links and return attributes for the real path at the base. if it is False, return attributes for the specified path.
def setAttrs(self, path, attrs): (source)

Set the attributes for the path.

This method returns when the attributes are set or a Deferred that is called back when they are.

Parameterspaththe path to set attributes for as a string. (type: bytes)
attrsa dictionary in the same format as the attrs argument to openFile.
def readLink(self, path): (source)

Find the root of a set of symbolic links.

This method returns the target of the link, or a Deferred that returns the same.

Parameterspaththe path of the symlink to read. (type: bytes)
def makeLink(self, linkPath, targetPath): (source)

Create a symbolic link.

This method returns when the link is made, or a Deferred that returns the same.

ParameterslinkPaththe pathname of the symlink as a string (type: bytes)
targetPaththe path of the target of the link as a string. (type: bytes)
def realPath(self, path): (source)

Convert any path to an absolute path.

This method returns the absolute path as a string, or a Deferred that returns the same.

Parameterspaththe path to convert as a string. (type: bytes)
def _cbRealPath(self, result): (source)

Undocumented

def extendedRequest(self, request, data): (source)

Make an extended request of the server.

The method returns a Deferred that is called back with the result of the extended request.

Parametersrequestthe name of the extended request to make. (type: bytes)
dataany other data that goes along with the request. (type: bytes)
def packet_VERSION(self, data): (source)

Undocumented

version = (source)

Undocumented

def packet_STATUS(self, data): (source)

Undocumented

def packet_HANDLE(self, data): (source)

Undocumented

def packet_DATA(self, data): (source)

Undocumented

def packet_NAME(self, data): (source)

Undocumented

def packet_ATTRS(self, data): (source)

Undocumented

def packet_EXTENDED_REPLY(self, data): (source)

Undocumented

def gotServerVersion(self, serverVersion, extData): (source)

Called when the client sends their version info.

ParametersserverVersionan integer representing the version of the SFTP protocol they are claiming.
extDataa dictionary of extended_name : extended_data items. These items are sent by the client to indicate additional features.
API Documentation for Twisted, generated by pydoctor 20.12.1 at 2021-02-28 19:53:36.