Initialization and Deinitialization

For details about the API call sequence for initialization and deinitialization, see API Call Sequence.

Principles

You must call acl.init for initialization. The configuration file is in JSON format. For details, see acl.init.

If the current default configurations meet the requirements and do not need to be modified, you do not need to input parameters to acl.init, or you can set the configuration file to an empty JSON string (that is, only {} exists in the configuration file). Do not input parameters to acl.init. The following is an example:
ret = acl.init()

Deinitialize pyacl by using the acl.finalize call after all pyacl API calls are complete or before the app exits.

Sample Code

You can obtain the complete sample code from Sample Introduction.

Following the API calls, add exception handling branches and specify log printing of error and information levels. The following is a code snippet of key steps only, which is not ready to use.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
import acl
# ......
# Initialize basic configurations.
# The .. path is relative to the directory of the executable file.
acl_config_path = "../src/acl.json"
ret = acl.init(acl_config_path)
# ......

# Deinitialization
ret = acl.finalize()
# ......