Initializing pyACL
For the API call sequence for pyACL initialization and deinitialization, see pyACL API Call Sequence.
Principles
Call the acl.init API to initialize pyACL. The configuration file is in JSON format. For details, see the description in 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()
The is deinitialized once it is initialized. After all s of the and py ACL are invoked, or before the application exits, the acl.finalize interface needs to be invoked to deinitialize the pyACL.
Sample Code
You can view the complete code in Sample Overview.
After APIs are called, add an exception handling branch, and record error logs and warning logs. 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() # ...... |