Python

Fetch users through local python script.

The following vars will be defined when running the script:

  • __file__

    This will be the absolute path of the script file

    Added in version 1.11.0.

The keys used in map format are:

  • script

    required, type: file path

    The path of the python script.

    Three global functions should be defined in this script, like this:

    def fetch_users():
        # required, takes no argument, returns the json string
        return "[]"
    
    def report_ok():
        # optional, takes no argument
        pass
    
    def report_err(errmsg):
        # optional, takes one positional argument, which is the error message string
        pass
    
  • fetch_timeout

    optional, type: humanize duration

    Set the timeout value for the execution of the fetch function.

    It’s not recommended to set the timeout value greater the refresh_interval in group config.

    default: 30s, alias: timeout

  • report_timeout

    optional, type: humanize duration

    Set the timeout value for the execution of the report functions.

    It’s not recommended to set the timeout value greater the refresh_interval in group config.

    default: 15s, alias: timeout