diff --git a/apprise/Apprise.py b/apprise/Apprise.py index 8512ea14..73adf629 100644 --- a/apprise/Apprise.py +++ b/apprise/Apprise.py @@ -32,6 +32,7 @@ from .AppriseAsset import AppriseAsset from . import NotifyBase from . import plugins +from . import __version__ logger = logging.getLogger(__name__) @@ -54,6 +55,9 @@ def __load_matrix(): # Get our plugin plugin = getattr(plugins, entry) + if not hasattr(plugin, 'app_id'): # pragma: no branch + # Filter out non-notification modules + continue # Load protocol(s) if defined proto = getattr(plugin, 'protocol', None) @@ -277,6 +281,52 @@ class Apprise(object): return status + def details(self): + """ + Returns the details associated with the Apprise object + + """ + + # general object returned + response = { + # Defines the current version of Apprise + 'version': __version__, + # Lists all of the currently supported Notifications + 'schemas': [], + # Includes the configured asset details + 'asset': self.asset.details(), + } + + # to add it's mapping to our hash table + for entry in sorted(dir(plugins)): + + # Get our plugin + plugin = getattr(plugins, entry) + if not hasattr(plugin, 'app_id'): # pragma: no branch + # Filter out non-notification modules + continue + + # Standard protocol(s) should be None or a tuple + protocols = getattr(plugin, 'protocol', None) + if compat_is_basestring(protocols): + protocols = (protocols, ) + + # Secure protocol(s) should be None or a tuple + secure_protocols = getattr(plugin, 'secure_protocol', None) + if compat_is_basestring(secure_protocols): + secure_protocols = (secure_protocols, ) + + # Build our response object + response['schemas'].append({ + 'service_name': getattr(plugin, 'service_name', None), + 'service_url': getattr(plugin, 'service_url', None), + 'setup_url': getattr(plugin, 'setup_url', None), + 'protocols': protocols, + 'secure_protocols': secure_protocols, + }) + + return response + def __len__(self): """ Returns the number of servers loaded diff --git a/apprise/AppriseAsset.py b/apprise/AppriseAsset.py index 5bbba2a9..4af1c72b 100644 --- a/apprise/AppriseAsset.py +++ b/apprise/AppriseAsset.py @@ -216,6 +216,21 @@ class AppriseAsset(object): return None + def details(self): + """ + Returns the details associated with the AppriseAsset object + + """ + return { + 'app_id': self.app_id, + 'app_desc': self.app_desc, + 'default_extension': self.default_extension, + 'theme': self.theme, + 'image_path_mask': self.image_url_mask, + 'image_url_mask': self.image_url_mask, + 'image_url_logo': self.image_url_logo, + } + @staticmethod def hex_to_rgb(value): """ diff --git a/apprise/plugins/NotifyBase.py b/apprise/plugins/NotifyBase.py index 9f028499..0a8a3687 100644 --- a/apprise/plugins/NotifyBase.py +++ b/apprise/plugins/NotifyBase.py @@ -34,7 +34,6 @@ except ImportError: from ..utils import parse_url from ..utils import parse_bool from ..utils import is_hostname -from ..common import NOTIFY_IMAGE_SIZES from ..common import NOTIFY_TYPES from ..common import NotifyFormat from ..common import NOTIFY_FORMATS @@ -70,7 +69,8 @@ PATHSPLIT_LIST_DELIM = re.compile(r'[ \t\r\n,\\/]+') # Regular expression retrieved from: # http://www.regular-expressions.info/email.html IS_EMAIL_RE = re.compile( - r"(?P[a-z0-9$%+=_~-]+" + r"((?P