Getting started - Login
This section describes how to get started with the Enterprise Manager Python SDK. To help you better understand how to implement the available methods, a code sample and a readme file that describes the code are located in the <Enterprise Manager_Installation_Folder>/clients/python folder.
To be able to use the Qlik Enterprise Manager Python API:
-
Import the Qlik Enterprise Manager-Client by adding the following code:
from aem_client import *
- Create an aem_client object using the following constructors: (self, b64_username_password, machine_name, port=443, url="https://{0}/attunityenterprisemanager", verify_certificate=True,authentication_method=AuthenticationMethod.ACTIVE_DIRECTORY):
- b64_username_password
For authentication using Active Directory:
You need to create a base64 encoding of “domain\\user:password” as follows:- domain_username = '{0}\\{1}'.format(domain, username)
- username_password_str = str.encode('{0}:{1}'.format(domain_username, password))
b64_username_password = b64.b64encode(username_password_ str).decode('ascii')
Information noteThis login method requires you to be in possession of a Personal Access Token generated in Enterprise Manager. For details, see Setting up OpenID Connect authenticationYou need to create a base64 encoding of “api-token:your-personal-access-token” as follows:
username_password_str = str.encode('{0}:{1}'.format('api-token', your-personal-access-token))
Where your-personal-access-token is the token that was generated for you in Enterprise Manager.
- b64_username_password = b64.b64encode(username_password_ str).decode('ascii')
machine_name - The machine on which Qlik Enterprise Manager is installed.
port – The Qlik Enterprise Manager server port (usually 443).
url – The URL to the Qlik Enterprise Manager server. If not set then https://{0}/attunityenterprisemanager is used where {0} is the machine name.
verify_certificate – When verify_certificate is set to true, there must be a valid certificate in the Qlik Enterprise Manager machine. When set to false, Qlik Enterprise Manager client will not validate the server certificate. The default is true.
Example:
aem_client = AemClient(b64_username_password, machine_name, verify_certificate=False)
authentication_method – The authentication method used by the Enterprise Manager server. Specify AuthenticationMethod.ACTIVE_DIRECTORY both for Active Directory authentication and OpenID Connect authentication.
The user can now use the client methods to get/set data from Qlik Enterprise Manager using the public APIs. For example:
- aem_client. get_server_list()
- aem_client. get_server_list()
- aem_client. export_task(server_name, task_name)
- b64_username_password