How to use the prom2teams.exceptions.MissingConnectorConfigKeyException function in prom2teams

To help you get started, we’ve selected a few prom2teams examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github idealista / prom2teams / prom2teams / server.py View on Github external
def get_config(provided_config_file):
    provided_config = configparser.ConfigParser()
    default_config_path = os.path.join(dir, 'config.ini')
    try:
        with open(default_config_path) as f_default:
            provided_config.read_file(f_default)

        with open(provided_config_file) as f_prov:
            provided_config.read_file(f_prov)

        if not provided_config.options('Microsoft Teams'):
            raise MissingConnectorConfigKeyException('missing connector key in provided config')

    except configparser.NoSectionError:
        raise MissingConnectorConfigKeyException('missing required Microsoft Teams / '
                                                 'connector key in provided config')
    return provided_config
github idealista / prom2teams / prom2teams / server.py View on Github external
def get_config(provided_config_file):
    provided_config = configparser.ConfigParser()
    default_config_path = os.path.join(dir, 'config.ini')
    try:
        with open(default_config_path) as f_default:
            provided_config.read_file(f_default)

        with open(provided_config_file) as f_prov:
            provided_config.read_file(f_prov)

        if not provided_config.options('Microsoft Teams'):
            raise MissingConnectorConfigKeyException('missing connector key in provided config')

    except configparser.NoSectionError:
        raise MissingConnectorConfigKeyException('missing required Microsoft Teams / '
                                                 'connector key in provided config')
    return provided_config