Merge pull request #22 from caronc/21-list-notification-feature

New function details() which grants developers access to apprise meta data
This commit is contained in:
lead2gold 2018-10-09 21:37:01 -04:00 committed by GitHub
commit be1ce59b74
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
28 changed files with 333 additions and 12 deletions

View File

@ -32,6 +32,7 @@ from .AppriseAsset import AppriseAsset
from . import NotifyBase from . import NotifyBase
from . import plugins from . import plugins
from . import __version__
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@ -54,6 +55,9 @@ def __load_matrix():
# Get our plugin # Get our plugin
plugin = getattr(plugins, entry) plugin = getattr(plugins, entry)
if not hasattr(plugin, 'app_id'): # pragma: no branch
# Filter out non-notification modules
continue
# Load protocol(s) if defined # Load protocol(s) if defined
proto = getattr(plugin, 'protocol', None) proto = getattr(plugin, 'protocol', None)
@ -277,6 +281,52 @@ class Apprise(object):
return status 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): def __len__(self):
""" """
Returns the number of servers loaded Returns the number of servers loaded

View File

@ -216,6 +216,21 @@ class AppriseAsset(object):
return None 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 @staticmethod
def hex_to_rgb(value): def hex_to_rgb(value):
""" """

View File

@ -34,7 +34,6 @@ except ImportError:
from ..utils import parse_url from ..utils import parse_url
from ..utils import parse_bool from ..utils import parse_bool
from ..utils import is_hostname from ..utils import is_hostname
from ..common import NOTIFY_IMAGE_SIZES
from ..common import NOTIFY_TYPES from ..common import NOTIFY_TYPES
from ..common import NotifyFormat from ..common import NotifyFormat
from ..common import NOTIFY_FORMATS from ..common import NOTIFY_FORMATS
@ -70,7 +69,8 @@ PATHSPLIT_LIST_DELIM = re.compile(r'[ \t\r\n,\\/]+')
# Regular expression retrieved from: # Regular expression retrieved from:
# http://www.regular-expressions.info/email.html # http://www.regular-expressions.info/email.html
IS_EMAIL_RE = re.compile( IS_EMAIL_RE = re.compile(
r"(?P<userid>[a-z0-9$%+=_~-]+" r"((?P<label>[^+]+)\+)?"
r"(?P<userid>[a-z0-9$%=_~-]+"
r"(?:\.[a-z0-9$%+=_~-]+)" r"(?:\.[a-z0-9$%+=_~-]+)"
r"*)@(?P<domain>(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+" r"*)@(?P<domain>(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+"
r"[a-z0-9](?:[a-z0-9-]*" r"[a-z0-9](?:[a-z0-9-]*"
@ -84,16 +84,25 @@ class NotifyBase(object):
This is the base class for all notification services This is the base class for all notification services
""" """
# The default descriptive name associated with the Notification
service_name = None
# The services URL
service_url = None
# The default simple (insecure) protocol # The default simple (insecure) protocol
# all inheriting entries must provide their protocol lookup # all inheriting entries must provide their protocol lookup
# protocol:// (in this example they would specify 'protocol') # protocol:// (in this example they would specify 'protocol')
protocol = '' protocol = None
# The default secure protocol # The default secure protocol
# all inheriting entries must provide their protocol lookup # all inheriting entries must provide their protocol lookup
# protocols:// (in this example they would specify 'protocols') # protocols:// (in this example they would specify 'protocols')
# This value can be the same as the defined protocol. # This value can be the same as the defined protocol.
secure_protocol = '' secure_protocol = None
# A URL that takes you to the setup/help of the specific protocol
setup_url = None
# Most Servers do not like more then 1 request per 5 seconds, so 5.5 gives # Most Servers do not like more then 1 request per 5 seconds, so 5.5 gives
# us a safe play range... # us a safe play range...

View File

@ -63,9 +63,18 @@ class NotifyBoxcar(NotifyBase):
A wrapper for Boxcar Notifications A wrapper for Boxcar Notifications
""" """
# The default descriptive name associated with the Notification
service_name = 'Boxcar'
# The services URL
service_url = 'https://boxcar.io/'
# All boxcar notifications are secure # All boxcar notifications are secure
secure_protocol = 'boxcar' secure_protocol = 'boxcar'
# A URL that takes you to the setup/help of the specific protocol
setup_url = 'https://github.com/caronc/apprise/wiki/Notify_boxcar'
# Boxcar URL # Boxcar URL
notify_url = 'https://boxcar-api.io/api/push/' notify_url = 'https://boxcar-api.io/api/push/'

View File

@ -49,10 +49,18 @@ class NotifyDiscord(NotifyBase):
A wrapper to Discord Notifications A wrapper to Discord Notifications
""" """
# The default descriptive name associated with the Notification
service_name = 'Discord'
# The services URL
service_url = 'https://discordapp.com/'
# The default secure protocol # The default secure protocol
secure_protocol = 'discord' secure_protocol = 'discord'
# A URL that takes you to the setup/help of the specific protocol
setup_url = 'https://github.com/caronc/apprise/wiki/Notify_discored'
# Discord Webhook # Discord Webhook
notify_url = 'https://discordapp.com/api/webhooks' notify_url = 'https://discordapp.com/api/webhooks'

View File

@ -47,7 +47,7 @@ WEBBASE_LOOKUP_TABLE = (
# Google GMail # Google GMail
( (
'Google Mail', 'Google Mail',
re.compile(r'^(?P<id>[^@]+)@(?P<domain>gmail\.com)$', re.I), re.compile(r'^((?P<label>[^+]+)\+)?(?P<id>[^@]+)@(?P<domain>gmail\.com)$', re.I),
{ {
'port': 587, 'port': 587,
'smtp_host': 'smtp.gmail.com', 'smtp_host': 'smtp.gmail.com',
@ -59,7 +59,7 @@ WEBBASE_LOOKUP_TABLE = (
# Pronto Mail # Pronto Mail
( (
'Pronto Mail', 'Pronto Mail',
re.compile(r'^(?P<id>[^@]+)@(?P<domain>prontomail\.com)$', re.I), re.compile(r'^((?P<label>[^+]+)\+)?(?P<id>[^@]+)@(?P<domain>prontomail\.com)$', re.I),
{ {
'port': 465, 'port': 465,
'smtp_host': 'secure.emailsrvr.com', 'smtp_host': 'secure.emailsrvr.com',
@ -71,7 +71,7 @@ WEBBASE_LOOKUP_TABLE = (
# Microsoft Hotmail # Microsoft Hotmail
( (
'Microsoft Hotmail', 'Microsoft Hotmail',
re.compile(r'^(?P<id>[^@]+)@(?P<domain>(hotmail|live)\.com)$', re.I), re.compile(r'^((?P<label>[^+]+)\+)?(?P<id>[^@]+)@(?P<domain>(hotmail|live)\.com)$', re.I),
{ {
'port': 587, 'port': 587,
'smtp_host': 'smtp.live.com', 'smtp_host': 'smtp.live.com',
@ -83,7 +83,7 @@ WEBBASE_LOOKUP_TABLE = (
# Yahoo Mail # Yahoo Mail
( (
'Yahoo Mail', 'Yahoo Mail',
re.compile(r'^(?P<id>[^@]+)@(?P<domain>yahoo\.(ca|com))$', re.I), re.compile(r'^((?P<label>[^+]+)\+)?(?P<id>[^@]+)@(?P<domain>yahoo\.(ca|com))$', re.I),
{ {
'port': 465, 'port': 465,
'smtp_host': 'smtp.mail.yahoo.com', 'smtp_host': 'smtp.mail.yahoo.com',
@ -95,7 +95,7 @@ WEBBASE_LOOKUP_TABLE = (
# Catch All # Catch All
( (
'Custom', 'Custom',
re.compile(r'^(?P<id>[^@]+)@(?P<domain>.+)$', re.I), re.compile(r'^((?P<label>[^+]+)\+)?(?P<id>[^@]+)@(?P<domain>.+)$', re.I),
{ {
# Setting smtp_host to None is a way of # Setting smtp_host to None is a way of
# auto-detecting it based on other parameters # auto-detecting it based on other parameters
@ -113,12 +113,18 @@ class NotifyEmail(NotifyBase):
""" """
# The default descriptive name associated with the Notification
service_name = 'E-Mail'
# The default simple (insecure) protocol # The default simple (insecure) protocol
protocol = 'mailto' protocol = 'mailto'
# The default secure protocol # The default secure protocol
secure_protocol = 'mailtos' secure_protocol = 'mailtos'
# A URL that takes you to the setup/help of the specific protocol
setup_url = 'https://github.com/caronc/apprise/wiki/Notify_email'
# Default Non-Encryption Port # Default Non-Encryption Port
default_port = 25 default_port = 25

View File

@ -37,6 +37,11 @@ class NotifyEmby(NotifyBase):
""" """
A wrapper for Emby Notifications A wrapper for Emby Notifications
""" """
# The default descriptive name associated with the Notification
service_name = 'Emby'
# The services URL
service_url = 'https://emby.media/'
# The default protocol # The default protocol
protocol = 'emby' protocol = 'emby'
@ -44,6 +49,9 @@ class NotifyEmby(NotifyBase):
# The default secure protocol # The default secure protocol
secure_protocol = 'embys' secure_protocol = 'embys'
# A URL that takes you to the setup/help of the specific protocol
setup_url = 'https://github.com/caronc/apprise/wiki/Notify_emby'
# Emby uses the http protocol with JSON requests # Emby uses the http protocol with JSON requests
emby_default_port = 8096 emby_default_port = 8096

View File

@ -28,9 +28,18 @@ class NotifyFaast(NotifyBase):
A wrapper for Faast Notifications A wrapper for Faast Notifications
""" """
# The default descriptive name associated with the Notification
service_name = 'Faast'
# The services URL
service_url = 'http://www.faast.io/'
# The default protocol (this is secure for faast) # The default protocol (this is secure for faast)
protocol = 'faast' protocol = 'faast'
# A URL that takes you to the setup/help of the specific protocol
setup_url = 'https://github.com/caronc/apprise/wiki/Notify_faast'
# Faast uses the http protocol with JSON requests # Faast uses the http protocol with JSON requests
notify_url = 'https://www.appnotifications.com/account/notifications.json' notify_url = 'https://www.appnotifications.com/account/notifications.json'

View File

@ -50,9 +50,18 @@ class NotifyGrowl(NotifyBase):
""" """
# The default descriptive name associated with the Notification
service_name = 'Growl'
# The services URL
service_url = 'http://growl.info/'
# The default protocol # The default protocol
protocol = 'growl' protocol = 'growl'
# A URL that takes you to the setup/help of the specific protocol
setup_url = 'https://github.com/caronc/apprise/wiki/Notify_growl'
# Default Growl Port # Default Growl Port
default_port = 23053 default_port = 23053

View File

@ -43,6 +43,18 @@ class NotifyIFTTT(NotifyBase):
""" """
# The default descriptive name associated with the Notification
service_name = 'IFTTT'
# The services URL
service_url = 'https://ifttt.com/'
# The default protocol
protocol = 'ifttt'
# A URL that takes you to the setup/help of the specific protocol
setup_url = 'https://github.com/caronc/apprise/wiki/Notify_ifttt'
# Even though you'll add 'Ingredients' as {{ Value1 }} to your Applets, # Even though you'll add 'Ingredients' as {{ Value1 }} to your Applets,
# you must use their lowercase value in the HTTP POST. # you must use their lowercase value in the HTTP POST.
ifttt_default_key_prefix = 'value' ifttt_default_key_prefix = 'value'
@ -65,9 +77,6 @@ class NotifyIFTTT(NotifyBase):
# value1, value2, and value3). # value1, value2, and value3).
ifttt_default_type_key = 'value3' ifttt_default_type_key = 'value3'
# The default protocol
protocol = 'ifttt'
# IFTTT uses the http protocol with JSON requests # IFTTT uses the http protocol with JSON requests
notify_url = 'https://maker.ifttt.com/trigger/{event}/with/key/{apikey}' notify_url = 'https://maker.ifttt.com/trigger/{event}/with/key/{apikey}'

View File

@ -30,12 +30,18 @@ class NotifyJSON(NotifyBase):
A wrapper for JSON Notifications A wrapper for JSON Notifications
""" """
# The default descriptive name associated with the Notification
service_name = 'JSON'
# The default protocol # The default protocol
protocol = 'json' protocol = 'json'
# The default secure protocol # The default secure protocol
secure_protocol = 'jsons' secure_protocol = 'jsons'
# A URL that takes you to the setup/help of the specific protocol
setup_url = 'https://github.com/caronc/apprise/wiki/Notify_Custom_JSON'
# Allows the user to specify the NotifyImageSize object # Allows the user to specify the NotifyImageSize object
image_size = NotifyImageSize.XY_128 image_size = NotifyImageSize.XY_128

View File

@ -64,9 +64,18 @@ class NotifyJoin(NotifyBase):
A wrapper for Join Notifications A wrapper for Join Notifications
""" """
# The default descriptive name associated with the Notification
service_name = 'Join'
# The services URL
service_url = 'https://joaoapps.com/join/'
# The default protocol # The default protocol
protocol = 'join' protocol = 'join'
# A URL that takes you to the setup/help of the specific protocol
setup_url = 'https://github.com/caronc/apprise/wiki/Notify_join'
# Join uses the http protocol with JSON requests # Join uses the http protocol with JSON requests
notify_url = \ notify_url = \
'https://joinjoaomgcd.appspot.com/_ah/api/messaging/v1/sendPush' 'https://joinjoaomgcd.appspot.com/_ah/api/messaging/v1/sendPush'

View File

@ -37,12 +37,21 @@ class NotifyMatterMost(NotifyBase):
A wrapper for MatterMost Notifications A wrapper for MatterMost Notifications
""" """
# The default descriptive name associated with the Notification
service_name = 'MatterMost'
# The services URL
service_url = 'https://mattermost.com/'
# The default protocol # The default protocol
protocol = 'mmost' protocol = 'mmost'
# The default secure protocol # The default secure protocol
secure_protocol = 'mmosts' secure_protocol = 'mmosts'
# A URL that takes you to the setup/help of the specific protocol
setup_url = 'https://github.com/caronc/apprise/wiki/Notify_mattermost'
# The default Mattermost port # The default Mattermost port
default_port = 8065 default_port = 8065

View File

@ -59,9 +59,18 @@ class NotifyProwl(NotifyBase):
A wrapper for Prowl Notifications A wrapper for Prowl Notifications
""" """
# The default descriptive name associated with the Notification
service_name = 'Prowl'
# The services URL
service_url = 'https://www.prowlapp.com/'
# The default secure protocol # The default secure protocol
secure_protocol = 'prowl' secure_protocol = 'prowl'
# A URL that takes you to the setup/help of the specific protocol
setup_url = 'https://github.com/caronc/apprise/wiki/Notify_prowl'
# Prowl uses the http protocol with JSON requests # Prowl uses the http protocol with JSON requests
notify_url = 'https://api.prowlapp.com/publicapi/add' notify_url = 'https://api.prowlapp.com/publicapi/add'

View File

@ -45,9 +45,18 @@ class NotifyPushBullet(NotifyBase):
A wrapper for PushBullet Notifications A wrapper for PushBullet Notifications
""" """
# The default descriptive name associated with the Notification
service_name = 'Pushbullet'
# The services URL
service_url = 'https://www.pushbullet.com/'
# The default secure protocol # The default secure protocol
secure_protocol = 'pbul' secure_protocol = 'pbul'
# A URL that takes you to the setup/help of the specific protocol
setup_url = 'https://github.com/caronc/apprise/wiki/Notify_pushbullet'
# PushBullet uses the http protocol with JSON requests # PushBullet uses the http protocol with JSON requests
notify_url = 'https://api.pushbullet.com/v2/pushes' notify_url = 'https://api.pushbullet.com/v2/pushes'

View File

@ -40,9 +40,18 @@ class NotifyPushalot(NotifyBase):
A wrapper for Pushalot Notifications A wrapper for Pushalot Notifications
""" """
# The default descriptive name associated with the Notification
service_name = 'Pushalot'
# The services URL
service_url = 'https://pushalot.com/'
# The default protocol is always secured # The default protocol is always secured
secure_protocol = 'palot' secure_protocol = 'palot'
# A URL that takes you to the setup/help of the specific protocol
setup_url = 'https://github.com/caronc/apprise/wiki/Notify_pushalot'
# Pushalot uses the http protocol with JSON requests # Pushalot uses the http protocol with JSON requests
notify_url = 'https://pushalot.com/api/sendmessage' notify_url = 'https://pushalot.com/api/sendmessage'

View File

@ -32,12 +32,21 @@ class NotifyPushjet(NotifyBase):
A wrapper for Pushjet Notifications A wrapper for Pushjet Notifications
""" """
# The default descriptive name associated with the Notification
service_name = 'Pushjet'
# The services URL
service_url = 'https://pushjet.io/'
# The default protocol # The default protocol
protocol = 'pjet' protocol = 'pjet'
# The default secure protocol # The default secure protocol
secure_protocol = 'pjets' secure_protocol = 'pjets'
# A URL that takes you to the setup/help of the specific protocol
setup_url = 'https://github.com/caronc/apprise/wiki/Notify_pushjet'
def __init__(self, **kwargs): def __init__(self, **kwargs):
""" """
Initialize Pushjet Object Initialize Pushjet Object

View File

@ -68,9 +68,18 @@ class NotifyPushover(NotifyBase):
A wrapper for Pushover Notifications A wrapper for Pushover Notifications
""" """
# The default descriptive name associated with the Notification
service_name = 'Pushover'
# The services URL
service_url = 'https://pushover.net/'
# All pushover requests are secure # All pushover requests are secure
secure_protocol = 'pover' secure_protocol = 'pover'
# A URL that takes you to the setup/help of the specific protocol
setup_url = 'https://github.com/caronc/apprise/wiki/Notify_pushover'
# Pushover uses the http protocol with JSON requests # Pushover uses the http protocol with JSON requests
notify_url = 'https://api.pushover.net/1/messages.json' notify_url = 'https://api.pushover.net/1/messages.json'

View File

@ -44,12 +44,21 @@ class NotifyRocketChat(NotifyBase):
A wrapper for Notify Rocket.Chat Notifications A wrapper for Notify Rocket.Chat Notifications
""" """
# The default descriptive name associated with the Notification
service_name = 'Rocket.Chat'
# The services URL
service_url = 'https://rocket.chat/'
# The default protocol # The default protocol
protocol = 'rocket' protocol = 'rocket'
# The default secure protocol # The default secure protocol
secure_protocol = 'rockets' secure_protocol = 'rockets'
# A URL that takes you to the setup/help of the specific protocol
setup_url = 'https://github.com/caronc/apprise/wiki/Notify_rocketchat'
# Defines the maximum allowable characters in the title # Defines the maximum allowable characters in the title
title_maxlen = 200 title_maxlen = 200

View File

@ -71,9 +71,18 @@ class NotifySlack(NotifyBase):
A wrapper for Slack Notifications A wrapper for Slack Notifications
""" """
# The default descriptive name associated with the Notification
service_name = 'Slack'
# The services URL
service_url = 'https://slack.com/'
# The default secure protocol # The default secure protocol
secure_protocol = 'slack' secure_protocol = 'slack'
# A URL that takes you to the setup/help of the specific protocol
setup_url = 'https://github.com/caronc/apprise/wiki/Notify_slack'
# Slack uses the http protocol with JSON requests # Slack uses the http protocol with JSON requests
notify_url = 'https://hooks.slack.com/services' notify_url = 'https://hooks.slack.com/services'

View File

@ -61,10 +61,18 @@ class NotifyStride(NotifyBase):
A wrapper to Stride Notifications A wrapper to Stride Notifications
""" """
# The default descriptive name associated with the Notification
service_name = 'Stride'
# The services URL
service_url = 'https://www.stride.com/'
# The default secure protocol # The default secure protocol
secure_protocol = 'stride' secure_protocol = 'stride'
# A URL that takes you to the setup/help of the specific protocol
setup_url = 'https://github.com/caronc/apprise/wiki/Notify_stride'
# Stride Webhook # Stride Webhook
notify_url = 'https://api.atlassian.com/site/{cloud_id}/' \ notify_url = 'https://api.atlassian.com/site/{cloud_id}/' \
'conversation/{convo_id}/message' 'conversation/{convo_id}/message'

View File

@ -81,10 +81,18 @@ class NotifyTelegram(NotifyBase):
""" """
A wrapper for Telegram Notifications A wrapper for Telegram Notifications
""" """
# The default descriptive name associated with the Notification
service_name = 'Telegram'
# The services URL
service_url = 'https://telegram.org/'
# The default secure protocol # The default secure protocol
secure_protocol = 'tgram' secure_protocol = 'tgram'
# A URL that takes you to the setup/help of the specific protocol
setup_url = 'https://github.com/caronc/apprise/wiki/Notify_telegram'
# Telegram uses the http protocol with JSON requests # Telegram uses the http protocol with JSON requests
notify_url = 'https://api.telegram.org/bot' notify_url = 'https://api.telegram.org/bot'

View File

@ -34,9 +34,18 @@ class NotifyToasty(NotifyBase):
A wrapper for Toasty Notifications A wrapper for Toasty Notifications
""" """
# The default descriptive name associated with the Notification
service_name = 'Toasty'
# The services URL
service_url = 'http://supertoasty.com/'
# The default protocol # The default protocol
protocol = 'toasty' protocol = 'toasty'
# A URL that takes you to the setup/help of the specific protocol
setup_url = 'https://github.com/caronc/apprise/wiki/Notify_toasty'
# Toasty uses the http protocol with JSON requests # Toasty uses the http protocol with JSON requests
notify_url = 'http://api.supertoasty.com/notify/' notify_url = 'http://api.supertoasty.com/notify/'

View File

@ -26,9 +26,18 @@ class NotifyTwitter(NotifyBase):
""" """
# The default descriptive name associated with the Notification
service_name = 'Twitter'
# The services URL
service_url = 'https://twitter.com/'
# The default secure protocol # The default secure protocol
secure_protocol = 'tweet' secure_protocol = 'tweet'
# A URL that takes you to the setup/help of the specific protocol
setup_url = 'https://github.com/caronc/apprise/wiki/Notify_twitter'
# The maximum allowable characters allowed in the body per message # The maximum allowable characters allowed in the body per message
# This is used during a Private DM Message Size (not Public Tweets # This is used during a Private DM Message Size (not Public Tweets
# which are limited to 240 characters) # which are limited to 240 characters)

View File

@ -47,9 +47,15 @@ class NotifyWindows(NotifyBase):
A wrapper for local Windows Notifications A wrapper for local Windows Notifications
""" """
# The default descriptive name associated with the Notification
service_name = 'Windows Notification'
# The default protocol # The default protocol
protocol = 'windows' protocol = 'windows'
# A URL that takes you to the setup/help of the specific protocol
setup_url = 'https://github.com/caronc/apprise/wiki/Notify_windows'
# Allows the user to specify the NotifyImageSize object # Allows the user to specify the NotifyImageSize object
image_size = NotifyImageSize.XY_128 image_size = NotifyImageSize.XY_128

View File

@ -31,12 +31,21 @@ class NotifyXBMC(NotifyBase):
A wrapper for XBMC/KODI Notifications A wrapper for XBMC/KODI Notifications
""" """
# The default descriptive name associated with the Notification
service_name = 'Kodi/XBMC'
# The services URL
service_url = 'http://kodi.tv/'
# The default protocols # The default protocols
protocol = ('xbmc', 'kodi') protocol = ('xbmc', 'kodi')
# The default secure protocols # The default secure protocols
secure_protocol = ('xbmc', 'kodis') secure_protocol = ('xbmc', 'kodis')
# A URL that takes you to the setup/help of the specific protocol
setup_url = 'https://github.com/caronc/apprise/wiki/Notify_kodi'
# XBMC uses the http protocol with JSON requests # XBMC uses the http protocol with JSON requests
xbmc_default_port = 8080 xbmc_default_port = 8080

View File

@ -30,12 +30,18 @@ class NotifyXML(NotifyBase):
A wrapper for XML Notifications A wrapper for XML Notifications
""" """
# The default descriptive name associated with the Notification
service_name = 'XML'
# The default protocol # The default protocol
protocol = 'xml' protocol = 'xml'
# The default secure protocol # The default secure protocol
secure_protocol = 'xmls' secure_protocol = 'xmls'
# A URL that takes you to the setup/help of the specific protocol
setup_url = 'https://github.com/caronc/apprise/wiki/Notify_Custom_XML'
# Allows the user to specify the NotifyImageSize object # Allows the user to specify the NotifyImageSize object
image_size = NotifyImageSize.XY_128 image_size = NotifyImageSize.XY_128

View File

@ -22,11 +22,14 @@ from os import getuid
from os.path import dirname from os.path import dirname
from apprise import Apprise from apprise import Apprise
from apprise import AppriseAsset from apprise import AppriseAsset
from apprise.utils import compat_is_basestring
from apprise.Apprise import SCHEMA_MAP from apprise.Apprise import SCHEMA_MAP
from apprise import NotifyBase from apprise import NotifyBase
from apprise import NotifyType from apprise import NotifyType
from apprise import NotifyFormat from apprise import NotifyFormat
from apprise import NotifyImageSize from apprise import NotifyImageSize
from apprise import plugins
from apprise import __version__
from apprise.Apprise import __load_matrix from apprise.Apprise import __load_matrix
import pytest import pytest
@ -468,3 +471,47 @@ def test_apprise_asset(tmpdir):
NotifyImageSize.XY_256, NotifyImageSize.XY_256,
extension='.test') == 'http://localhost/' extension='.test') == 'http://localhost/'
'default/info-256x256.test') 'default/info-256x256.test')
def test_apprise_details():
"""
API: Apprise() Details
"""
# Caling load matix a second time which is an internal function causes it
# to skip over content already loaded into our matrix and thefore accesses
# other if/else parts of the code that aren't otherwise called
__load_matrix()
a = Apprise()
# Details object
details = a.details()
# Dictionary response
assert isinstance(details, dict)
# Apprise version
assert 'version' in details
assert details.get('version') == __version__
# Defined schemas identify each plugin
assert 'schemas' in details
assert isinstance(details.get('schemas'), list)
# We have an entry per defined plugin
assert 'asset' in details
assert isinstance(details.get('asset'), dict)
assert 'app_id' in details['asset']
assert 'app_desc' in details['asset']
assert 'default_extension' in details['asset']
assert 'theme' in details['asset']
assert 'image_path_mask' in details['asset']
assert 'image_url_mask' in details['asset']
assert 'image_url_logo' in details['asset']
# All plugins must have a name defined; the below generates
# a list of entrys that do not have a string defined.
assert(not len([x['service_name'] for x in details['schemas']
if not compat_is_basestring(x['service_name'])]))