das element-ary school
Breadcrumbs

API

The Python API is a wrapper around the command line version (CLI).

API Documentation

http://docu.api.das-element.com


How to use


Install

In your Python environment run the command:

pip install daselement-api


Configuration

In the background the CLI versions of Das Element get executed. We need to specify where to find the executables. This is done by setting an environment variable.

Set the environment variables to point to the CLI executable files:

DASELEMENT_CLI (for the small CLI version)
DASELEMENT_CLI_FULL (for the full CLI version)

Set the environment variable globally on your system or directly in the Python script:

import os

os.environ['DASELEMENT_CLI'] = '/path/to/das-element-cli/das-element-cli_2.2.0'
os.environ['DASELEMENT_CLI_FULL'] = '/path/to/das-element-cli/das-element-cli-full_2.2.0'

from daselement_api import api as de

new_config_path = "/path/to/new-library/.config/config.conf"
de.create_config(config_path, preset_key='preserve_structure')


Usage

The library information is taken from the config file that is set for the current workstation.
Either defined in the ~/.das-element/setup.ini file or by the environment variable DASELEMENT_CONFIG_PATH


from daselement_api import api as de
libraries = de.get_libraries()
for library, library_config_data in libraries.items():
   print(library)
   print(library_config_data)


See available commands here: http://docu.api.das-element.com