The FASPManager interface is available in a pure Python implementation. To utilize this, you will need to extract the entire
pyFaspMgmt directory to the Python application that you want to integrate with FASPManager and then use the
The Python FASPManager interface class with the following methods:
__init__(self, user, dest_host, src_files=, password='', key_file='', dest_port=0, dest_files=, args=, dest_dir='', persistent=False)
Initialized a FASP Session with user and destination defined. Supports the optional arguments of password, key_file, dest_port, src_files, dest_dir, args (command line arguments as a list), persistent
- regularSession = FaspSend( "root", "dest.example.com", src_files = [ 'one, 'two' ], password = "Secret" )
- persistentSession = FaspSend( "root", "dest.example.com", persistent=True, password="Secret" )
addFile(self, src, dest)
When persistent sessions is enabled this will transfer src and name it the dest.
Frees all resources associated with transfer and terminates active transfer.
Close persistent session, you can use getStatus to check if session has completed.
Consume any messages that have been generated.
Get an identifier from SESSION notification
If precompute is enabled this will return the percentage of completeness (0-100%)
Return the current session state, which could be INIT, SESSION, DONE, ERROR
Bytes and Files Output Example
The example Python code below illustrates how the output is rendered for files and bytes when using the Python FASPManager.
When you import pyfaspmgmt a configuration and log file are automatically created in your current directory. You can control where pyfaspmgmt looks for it's configuration file by editing configPaths in the config.py file. A typical faspmgmt.conf file is seen below, it is important to note that the file must be writable since the configuration file is used to ensure that each session identifier is unique.
The logging subsytem uses Python's standard logging and by default logs are rotated every 10MB with a maximum of 5 logs kept. In normal operation very little should be logged, however it is a good place to check if you are encountering errors by referencing the logs. If you find that the verbosity of the logs is not sufficient to debug any problems being encountered you can enable debugging by setting debug to true in the configuration file. This will log nearly everything the program does and is a good way to find the problem. The most important thing to look at when debugging is how ASCP is being called (you can simply grep for ascp), then make sure the command works as expected outside of your application.