How to use the apprise.plugins.NotifyBase.NotifyBase.parse_url function in apprise

To help you get started, we’ve selected a few apprise 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 caronc / apprise / apprise / plugins / NotifyEmail.py View on Github external
def parse_url(url):
        """
        Parses the URL and returns enough arguments that can allow
        us to substantiate this object.

        """
        results = NotifyBase.parse_url(url)

        if not results:
            # We're done early as we couldn't load the results
            return results

        # The From address is a must; either through the use of templates
        # from= entry and/or merging the user and hostname together, this
        # must be calculated or parse_url will fail.
        from_addr = ''

        # The server we connect to to send our mail to
        smtp_host = ''

        # Get our potential email targets; if none our found we'll just
        # add one to ourselves
        results['targets'] = NotifyEmail.split_path(results['fullpath'])
github caronc / apprise / apprise / plugins / NotifyTwitter / NotifyTwitter.py View on Github external
def parse_url(url):
        """
        Parses the URL and returns enough arguments that can allow
        us to substantiate this object.

        """
        results = NotifyBase.parse_url(url)

        if not results:
            # We're done early as we couldn't load the results
            return results

        # Apply our settings now

        # The first token is stored in the hostname
        consumer_key = results['host']

        # Now fetch the remaining tokens
        try:
            consumer_secret, access_token_key, access_token_secret = \
                [x for x in filter(bool, NotifyBase.split_path(
                    results['fullpath']))][0:3]
github caronc / apprise / apprise / plugins / NotifyNotica.py View on Github external
def parse_url(url):
        """
        Parses the URL and returns enough arguments that can allow
        us to substantiate this object.

        """
        results = NotifyBase.parse_url(url, verify_host=False)
        if not results:
            # We're done early as we couldn't load the results
            return results

        # Get unquoted entries
        entries = NotifyNotica.split_path(results['fullpath'])
        if not entries:
            # If there are no path entries, then we're only dealing with the
            # official website
            results['mode'] = NoticaMode.OFFICIAL

            # Store our token using the host
            results['token'] = NotifyNotica.unquote(results['host'])

            # Unset our host
            results['host'] = None
github caronc / apprise / apprise / plugins / NotifyKumulos.py View on Github external
def parse_url(url):
        """
        Parses the URL and returns enough arguments that can allow
        us to substantiate this object.

        """
        results = NotifyBase.parse_url(url)

        if not results:
            # We're done early as we couldn't load the results
            return results

        # The first token is stored in the hostname
        results['apikey'] = NotifyKumulos.unquote(results['host'])

        # Now fetch the remaining tokens
        try:
            results['serverkey'] = \
                NotifyKumulos.split_path(results['fullpath'])[0]

        except IndexError:
            # no token
            results['serverkey'] = None
github caronc / apprise / apprise / plugins / NotifyPushover.py View on Github external
def parse_url(url):
        """
        Parses the URL and returns enough arguments that can allow
        us to substantiate this object.

        """
        results = NotifyBase.parse_url(url)

        if not results:
            # We're done early as we couldn't load the results
            return results

        # Set our priority
        if 'priority' in results['qsd'] and len(results['qsd']['priority']):
            _map = {
                'l': PushoverPriority.LOW,
                'm': PushoverPriority.MODERATE,
                'n': PushoverPriority.NORMAL,
                'h': PushoverPriority.HIGH,
                'e': PushoverPriority.EMERGENCY,
            }
            try:
                results['priority'] = \
github caronc / apprise / apprise / plugins / NotifyGitter.py View on Github external
def parse_url(url):
        """
        Parses the URL and returns enough arguments that can allow
        us to substantiate this object.

        """
        results = NotifyBase.parse_url(url)

        if not results:
            # We're done early as we couldn't load the results
            return results

        results['token'] = NotifyGitter.unquote(results['host'])

        # Get our entries; split_path() looks after unquoting content for us
        # by default
        results['targets'] = NotifyGitter.split_path(results['fullpath'])

        # Support the 'to' variable so that we can support targets this way too
        # The 'to' makes it easier to use yaml configuration
        if 'to' in results['qsd'] and len(results['qsd']['to']):
            results['targets'] += NotifyGitter.parse_list(results['qsd']['to'])
github caronc / apprise / apprise / plugins / NotifyMSTeams.py View on Github external
def parse_url(url):
        """
        Parses the URL and returns enough arguments that can allow
        us to substantiate this object.

        """
        results = NotifyBase.parse_url(url, verify_host=False)

        if not results:
            # We're done early as we couldn't load the results
            return results

        # Get unquoted entries
        entries = NotifyMSTeams.split_path(results['fullpath'])

        if results.get('user'):
            # If a user was found, it's because it's still part of the first
            # token, so we concatinate them
            results['token_a'] = '{}@{}'.format(
                NotifyMSTeams.unquote(results['user']),
                NotifyMSTeams.unquote(results['host']),
            )
github caronc / apprise / apprise / plugins / NotifyTechulusPush.py View on Github external
def parse_url(url):
        """
        Parses the URL and returns enough arguments that can allow
        us to substantiate this object.

        """
        results = NotifyBase.parse_url(url, verify_host=False)

        if not results:
            # We're done early as we couldn't load the results
            return results

        # The first apikey is stored in the hostname
        results['apikey'] = NotifyTechulusPush.unquote(results['host'])

        return results
github caronc / apprise / apprise / plugins / NotifyMailgun.py View on Github external
def parse_url(url):
        """
        Parses the URL and returns enough arguments that can allow
        us to substantiate this object.

        """
        results = NotifyBase.parse_url(url)

        if not results:
            # We're done early as we couldn't load the results
            return results

        # Get our entries; split_path() looks after unquoting content for us
        # by default
        results['targets'] = NotifyMailgun.split_path(results['fullpath'])

        # Our very first entry is reserved for our api key
        try:
            results['apikey'] = results['targets'].pop(0)

        except IndexError:
            # We're done - no API Key found
            results['apikey'] = None
github caronc / apprise / apprise / plugins / NotifyPushalot.py View on Github external
def parse_url(url):
        """
        Parses the URL and returns enough arguments that can allow
        us to substantiate this object.

        """
        results = NotifyBase.parse_url(url)

        if not results:
            # We're done early as we couldn't load the results
            return results

        # Apply our settings now
        results['authtoken'] = results['host']

        return results