Use configuration file for DA Tools
If you want to use a configuration file, edit notebooks/da-pipelines.ini.example and store your access data there.
If you do this, you can use an instance of wftools.configuration.configs.INIConfig to read the file and pass it to different classes that require access to WorkFusion or other APIs.
If you don't pass it, or the configuration file doesn't have specific access data stored, you will be requested to provide the required access data. Once you provide the data, it is stored in the cofiguration instance, and you won't be asked for input again if it's needed.
For example, you can use:
from wftools.configuration.configs import INIConfig
from wftools.resources.gui import FilesystemResourceCreator
cfg = INIConfig()
FilesystemResourceCreator(cfg)
If da-pipelines.ini contains the key and value for LOCAL_DIR_PATH in the general section of the configuration, it is used for creating the filesystem resource. If the key is not present, you are prompted to input the value. If the value is correct (meaning you can create the Resource = the directory exists), you won't be prompted again for it if it's needed again. You can also create a resource without specifying the configuration file, for instance:
from wftools.resources.gui import FilesystemResourceCreator
FilesystemResourceCreator()
If you do this, you are prompted to input access data, and the data won't be stored in any configuration file for future use. It's a good way of accessing some ad-hoc resources for which you don't want to store access data in your configuration file.
In the configution file, you can also specify different profiles with random names. For example, to da-pipelines.ini, you can add a profile (section) named external_s3:
[external_s3]
S3_ENDPOINT=example.workfusion.com
S3_ACCESS_KEY=example_key
S3_SECRET_TOKEN=example_token
S3_BUCKET=example_bucket_name
Then, you can use the profile like this:
from wftools.configuration.configs import INIConfig
from wftools.resources.gui import FilesystemResourceCreator
cfg = INIConfig()
with cfg.enabled_profile("external_s3"):
FilesystemResourceCreator(cfg)
In the above case, the credentials from the external_s3 configuration profile are used for creating a filesystem resource.
Similarly to a default profile, if you enable a profile, and it doesn't have required access data, you are prompted to input it. After you provide the data (and they are correct), these data are stored inside the configuration file under the specified profile.