Reading JSON Config Parameters
A JSON config can be used to pass run-time parameters to the module. The mrdhelper.py module has a get_json_config_param helper function to parse these parameters from within the module. Examples are provided in invertcontrast.json and filter.json.
The get_json_config_param function signature is:
def get_json_config_param(config, key, default=None, type='str'):
Usage examples:
# String parameter (default type)
options = mrdhelper.get_json_config_param(config, 'options')
# Boolean with default
sendOriginal = mrdhelper.get_json_config_param(config, 'sendOriginal', default=False, type='bool')
# Integer with default
filterSize = mrdhelper.get_json_config_param(config, 'filterSize', default=0, type='int')
Reference
- Source file:
mrdhelper.py—get_json_config_param() - Permalink: invertcontrast.py L288, L415, filter.py#L307
- Search anchor:
get_json_config_param