How to use the mattermostdriver.exceptions.InvalidOrMissingParameters 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 sandialabs / dr_robot / src / robot_api / api / upload.py View on Github external
**kwargs:
                filepath: (String) optional filepath to check for files to upload
        Returns:

        """
        print("[*] doing post message")
        try:
            self.inst.login()

            team_id = self.inst.teams.get_team_by_name(self.team_name)['id']
            channel_id = self.inst.channels.get_channel_by_name(
                channel_name=self.channel_name, team_id=team_id)['id']
        except exceptions.NoAccessTokenProvided as er:
            print(f"[!] NoAccessTokenProvided {er}")
            logger.exception()
        except exceptions.InvalidOrMissingParameters as er:
            print(f"[!] InvalidOrMissingParameters {er}")
            logger.exception()

        try:
            if isfile(self.filepath):
                file_ids = [
                    self.inst.files.upload_file(
                        channel_id=channel_id, files={
                            'files': (
                                basename(
                                    self.filepath), open(
                                    join_abs(
                                        self.filepath), 'rb'))})['file_infos'][0]['id']]

                self.inst.posts.create_post(options={
                    'channel_id': channel_id,