A class to wrap the ftp client functions.
Each operation in this class blocks until the operation has completed
There is currently no way to abort an operation
If you must abort an operation use the FtpClient class
Methods
|
|
|
|
__del__
|
__del__ ( self )
Destroy an instance.
Free's any remaining callbacks, destroyes the underlying handle, and deactivates
the module.
Raises:
A FtpClientException is thrown if unable to destroy the handle or deactivate
the module.
|
|
__init__
|
__init__ (
self,
handleAttr=None,
handle=None,
)
Constructs an instance.
Create a new FtpClient instance. This will init the ftp client module and
create a new ftp client handle if none is passed in.
Arguments:
handleAttr A HandleAttr object with the attributes set for
this object.
handle If a SWIG'ized pointer to a globus ftp client handle object
is passed in, create a new instance around this handle. The class
then owns the underlying pointer, and will delete it when the instance
is destroyed.
Raises:
A FtpClientException is thrown if unable to init the module or create
the underlying handle.
|
|
delete
|
delete (
self,
url,
attr=None,
)
Delete a file from a ftp server.
This method blocks until the file has been deleted
Arguments:
Returns
Nothing is returned Raises:
A FtpClientException is thrown if unable to initi ate the delete.
|
|
done_cb
|
done_cb (
self,
cv,
handle,
error,
)
Callback that has the signature
function(arg, handle, error)' where arg is the argument passed into this
call, handle is a SWIG'ized pointer to a ftp client handle object, and error
is a string containing NONE , or an error message. This function handles these types of callbacks in the easyFtpClient class
|
|
done_cb_exists
|
done_cb_exists (
self,
arglist,
handle,
error,
)
This callback is for the exists method
It is called after the existence check has returned from the ftp Server
|
|
exists
|
exists (
self,
url,
attr=None,
)
determines whether a file exists on a ftp server
When the existence has been determined the complete callback is called
Arguements
* url, the location of the file
* attr, An OperationAttr object, if none is given then
the default OperationAttr is created and used
Returns
a boolean indicating whether the file exists Raises
An FtpClientException if the existence cannot be determined
|
|
get
|
get (
self,
dest_file,
url,
attr=None,
marker=None,
)
Get a file from an ftp server.
After calling this method, register_read can be called to begin retrieving
the data. When all of the data associated with this URL is retrieved, and all
of the data callbacks have completed, or if the get request is aborted, the
complete callback will be called with the final status of the get.
Arguments:
Returns
Nothing is returned
Raises:
A FtpClientException is thrown if unable to initiate the get.
|
|
list
|
list (
self,
url,
attr=None,
)
Get a file listing from an ftp server.
This method starts a NLIST transfer from an ftp server. The client may begin
calling register_read to retrieve the listing, after this method returns. When all
of the data associated with the listing is returned, and all of the data callbacks
executed, the callback will be called with the final status of the list.
Arguments:
Returns
A string of the NLIST transfer is returned
Raises:
A FtpClientException is thrown if unable to initiate the list.
|
|
mkdir
|
mkdir (
self,
url,
attr=None,
)
Make a directory on a ftp server.
The callback will be called with the final status of the mkdir.
Arguments:
Returns
Nothing is returned
Raises:
A FtpClientException is thrown if unable to initi ate the mkdir.
|
|
modification_time
|
modification_time (
self,
url,
attr=None,
)
Retrieves the size of a file on a ftp server
When the modification time is retrieved the complete callback is called
Arguements
* url, the location of the file
* attr, An OperationAttr object, if none is given then
the default OperationAttr is created and used
Returns
the string of the modification time Raises
An FtpClientException if the modification time cannot be retrieved
|
|
move
|
move (
self,
srcUrl,
destUrl,
attr=None,
)
Move a file on a ftp server.
The complete callback will be called when the move is completed.
Arguments:
Returns
Nothing is returned
Raises:
A FtpClientException is thrown if unable to initiate the move.
|
|
partial_get
|
partial_get (
self,
dest_file,
url,
offset,
endOffset,
attr=None,
marker=None,
)
Get part of a file from a ftp server.
After calling this method, register_read can be called to begin retrieving
the data. When all of the data associated with this URL is retrieved, and all
of the data callbacks have completed, or if the get request is aborted, the
complete callback will be called with the final status of the get.
Arguments:
url The url to download.
attr An OperationAttr object containing the attributes for
this get.
marker A RestartMarker object.
offset An int or long offset to begin the transfer at.
endOffset An int or long offset to end the transfer at.
Returns
Nothing is returned
Raises:
A FtpClientException is thrown if unable to initiate the partial get.
|
|
partial_put
|
partial_put (
self,
src_file,
url,
offset,
endOffset,
attr=None,
marker=None,
)
Put part of a file onto a ftp server.
After calling this method, register_write can be called to begin writing
the data. When all of the data associated with this URL is sent, and all
of the data callbacks have completed, or if the partial_put request is aborted, the
complete callback will be called with the final status of the partial_put.
Arguments:
url The url to download.
attr An OperationAttr object containing the attributes for
this partial_put.
marker A RestartMarker object.
offset An int or long offset to begin the transfer at.
endOffset An int or long offset to end the transfer at.
Returns
Nothing is returned
Raises: A FtpClientException is thrown if unable to initiate the partial put.
|
|
partial_third_party_transfer
|
partial_third_party_transfer (
self,
srcUrl,
destUrl,
offset,
endOffset,
srcAttr=None,
destAttr=None,
marker=None,
)
Transfer part of a file between two ftp servers.
When the transfer is complete, the complete callback will be called with the
final status of the transfer.
Arguments:
srcUrl The url to transfer.
srcAttr An OperationAttr object containing the attributes
for the source.
destUrl The url to store the data to.
destAttr An OperationAttr object containing the attributes
for the destination.
marker A RestartMarker object.
offset An int or long offset to start the transfer from.
endOffset An int or long offset to end the transfer at.
Returns
Nothing is returned
Raises:
A FtpClientException is thrown if unable to initiate the transfer.
|
|
put
|
put (
self,
src_file,
url,
attr=None,
marker=None,
)
Store a file on an ftp server.
After calling this method, register_write can be called to begin writing
the data. When all of the data associated with this URL is sent, and all
of the data callbacks have completed, or if the put request is aborted, the
complete callback will be called with the final status of the put.
Arguments:
url The url to store the data to.
attr An OperationAttr object containing the attributes for
this put.
marker A RestartMarker object.
Returns
Nothing is returned
Raises:
A FtpClientException is thrown if unable to initiate the put.
|
|
read_cb
|
read_cb (
self,
fd,
handle,
buffer,
bufHandle,
bufLen,
offset,
eof,
error,
)
This is a callback function that is for the register_read method
It is called when a the buffer is full with data that has arrived to the handle
It is used as a data callback for the *get methods
|
|
rmdir
|
rmdir (
self,
url,
attr=None,
)
Remove a directory on a ftp server.
The callback will be called with the final status of the rmdir.
Arguments:
Returns
Nothing is returned
Raises:
A FtpClientException is thrown if unable to initi ate the rmdir.
|
|
size
|
size (
self,
url,
attr=None,
)
Retrieves the size of a file on a ftp server
When the size is retrieved the complete callback is called
Arguements
* url, the location of the file
* attr, An OperationAttr object, if none is given then
the default OperationAttr is created and used
Returns
the size of the file
Raises
An FtpClientException if the size cannont be retrieved
|
|
small_read_cb
|
small_read_cb (
self,
arg,
handle,
buffer,
bufHandle,
bufLen,
offset,
eof,
error,
)
This function is for doing small reads such as a verbose_list.
The result is stored in a string, instead of being written to a file
|
|
third_party_transfer
|
third_party_transfer (
self,
srcUrl,
destUrl,
srcAttr=None,
destAttr=None,
marker=None,
)
Transfer a file between two ftp servers.
When the transfer is complete, the complete callback will be called with the
final status of the transfer.
Arguments:
srcUrl The url to transfer.
srcAttr An OperationAttr object containing the attributes
for the source.
destUrl The url to store the data to.
destAttr An OperationAttr object containing the attributes
for the destination.
marker A RestartMarker object
Returns
Nothing is returned
Raises:
A FtpClientException is thrown if unable to initiate the transfer.
|
|
verbose_list
|
verbose_list (
self,
url,
attr=None,
)
Get a file listing from an ftp server.
This method blocks until the list of the url is retrieved
This method starts a LIST transfer from an ftp server. The client may begin
calling register_read to retrieve the listing, after this method returns. When all
of the data associated with the listing is returned, and all of the data callbacks
executed, the callback will be called with the final status of the list.
Arguments:
Returns
A string of the LIST transfer is returned
Raises:
A FtpClientException is thrown if unable to initiate the list.
|
|
write_cb
|
write_cb (
self,
fd,
handle,
buffer,
bufHandle,
bufLen,
offset,
eof,
error,
)
This is a callback function for the register_write method.
It is called when the handle has recieved the buffer
It is used as a data callback for the *put methods
|
|