finished applying meta data for details() function; refs #21

pull/22/head
Chris Caron 2018-10-09 21:22:20 -04:00
parent 4479a7f71b
commit e02940dab4
20 changed files with 179 additions and 7 deletions

View File

@ -55,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)
@ -299,13 +302,27 @@ class Apprise(object):
# 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
# 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 # Build our response object
response['schemas'].append({ response['schemas'].append({
'service_name': getattr(plugin, 'service_name', None), 'service_name': getattr(plugin, 'service_name', None),
'service_url': getattr(plugin, 'service_url', None), 'service_url': getattr(plugin, 'service_url', None),
'protocol': getattr(plugin, 'protocol', None), 'setup_url': getattr(plugin, 'setup_url', None),
'secure_protocol': getattr(plugin, 'secure_protocol', None), 'protocols': protocols,
'secure_protocols': secure_protocols,
}) })
return response return response

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,6 +22,7 @@ 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
@ -500,8 +501,6 @@ def test_apprise_details():
assert isinstance(details.get('schemas'), list) assert isinstance(details.get('schemas'), list)
# We have an entry per defined plugin # We have an entry per defined plugin
assert len(details.get('schemas')) == len(dir(plugins))
assert 'asset' in details assert 'asset' in details
assert isinstance(details.get('asset'), dict) assert isinstance(details.get('asset'), dict)
assert 'app_id' in details['asset'] assert 'app_id' in details['asset']
@ -511,3 +510,8 @@ def test_apprise_details():
assert 'image_path_mask' in details['asset'] assert 'image_path_mask' in details['asset']
assert 'image_url_mask' in details['asset'] assert 'image_url_mask' in details['asset']
assert 'image_url_logo' 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'])]))