How to use the mattermostdriver.Driver function in mattermostdriver

To help you get started, we’ve selected a few mattermostdriver 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 anl-cyberscience / LQMToolset / lqmt / tools / to_mattermost / tool.py View on Github external
def __init__(self, config):
        """
        ToMattermost tool.
        :param config: configuration file
        """
        super().__init__(config, [AlertAction.get('OtherAction')])
        self._logger = logging.getLogger("LQMT.ToMattermost.{0}".format(self.getName()))

        self.client = mattermostdriver.Driver({
            'scheme': self._config.scheme,
            'url': self._config.url,
            'port': self._config.port,
            'login_id': self._config.login,
            'password': self._config.password
        })

        self.tool_user_id = 'Unknown'
github sandialabs / dr_robot / src / robot_api / api / upload.py View on Github external
def __init__(self, **kwargs):
        """Initialize Mattermost class which extends Chat ABC
        Args:
            **kwargs: args to pass to Chat ABC
            team_channel : (String) required for posting to channel
            channel_name : (String) required for posting to channel
        """
        super().__init__(**kwargs)
        self.inst = Driver({
            'url': self.url,
            'verify': False,
            'token': self.api_key,
            'username': self.username,
            'port': kwargs.get('port', 8065)
        })
        self.team_name = kwargs.get("team_name", None)
        self.channel_name = kwargs.get("channel_name", None)
        self.filepath = kwargs.get("filepath", None)
github pcjl / mattermost-coffeebot / pair.py View on Github external
def main():
    print("Creating Mattermost Driver...")
    driver_options = {
        'url': config.URL,
        'login_id': config.USERNAME,
        'password': config.PASSWORD,
        'port': config.PORT
    }
    driver = Driver(driver_options)

    print("Authenticating...")
    driver.login()
    driver.users.get_user('me')
    print("Successfully authenticated.")

    print("Retrieving Coffee Buddies participants...")
    team_name = config.TEAM_NAME
    channel_name = config.CHANNEL_NAME
    members = utils.get_channel_members(driver, team_name, channel_name)
    print("Successfully retrieved Coffee Buddies participants.")

    print("Preparing participants database...")
    utils.create_users(members)
    utils.create_pairs(members)
    print("Succesfully prepared participants database.")
github opsdroid / opsdroid / opsdroid / connector / mattermost / __init__.py View on Github external
super().__init__(config, opsdroid=opsdroid)
        _LOGGER.debug(_("Starting Mattermost connector"))
        self.name = "mattermost"
        self.token = config["token"]
        self.url = config["url"]
        self.team_name = config["team-name"]
        self.scheme = config.get("scheme", "https")
        self.port = config.get("port", 8065)
        self.verify = config.get("ssl-verify", True)
        self.timeout = config.get("connect-timeout", 30)
        self.request_timeout = None
        self.mfa_token = None
        self.debug = False
        self.listening = True

        self.mm_driver = Driver(
            {
                "url": self.url,
                "token": self.token,
                "scheme": self.scheme,
                "port": self.port,
                "verify": self.verify,
                "timeout": self.timeout,
                "request_timeout": self.request_timeout,
                "mfa_token": self.mfa_token,
                "debug": self.debug,
            }