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

This commit is contained in:
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
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)
@ -299,13 +302,27 @@ class Apprise(object):
# 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),
'protocol': getattr(plugin, 'protocol', None),
'secure_protocol': getattr(plugin, 'secure_protocol', None),
'setup_url': getattr(plugin, 'setup_url', None),
'protocols': protocols,
'secure_protocols': secure_protocols,
})
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,
# you must use their lowercase value in the HTTP POST.
ifttt_default_key_prefix = 'value'
@ -65,9 +77,6 @@ class NotifyIFTTT(NotifyBase):
# value1, value2, and value3).
ifttt_default_type_key = 'value3'
# The default protocol
protocol = 'ifttt'
# IFTTT uses the http protocol with JSON requests
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
"""
# The default descriptive name associated with the Notification
service_name = 'JSON'
# The default protocol
protocol = 'json'
# The default secure protocol
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
image_size = NotifyImageSize.XY_128

View File

@ -64,9 +64,18 @@ class NotifyJoin(NotifyBase):
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
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
notify_url = \
'https://joinjoaomgcd.appspot.com/_ah/api/messaging/v1/sendPush'

View File

@ -37,12 +37,21 @@ class NotifyMatterMost(NotifyBase):
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
protocol = 'mmost'
# The default secure protocol
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
default_port = 8065

View File

@ -59,9 +59,18 @@ class NotifyProwl(NotifyBase):
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
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
notify_url = 'https://api.prowlapp.com/publicapi/add'

View File

@ -45,9 +45,18 @@ class NotifyPushBullet(NotifyBase):
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
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
notify_url = 'https://api.pushbullet.com/v2/pushes'

View File

@ -40,9 +40,18 @@ class NotifyPushalot(NotifyBase):
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
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
notify_url = 'https://pushalot.com/api/sendmessage'

View File

@ -32,12 +32,21 @@ class NotifyPushjet(NotifyBase):
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
protocol = 'pjet'
# The default secure protocol
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):
"""
Initialize Pushjet Object

View File

@ -68,9 +68,18 @@ class NotifyPushover(NotifyBase):
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
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
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
"""
# The default descriptive name associated with the Notification
service_name = 'Rocket.Chat'
# The services URL
service_url = 'https://rocket.chat/'
# The default protocol
protocol = 'rocket'
# The default secure protocol
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
title_maxlen = 200

View File

@ -71,9 +71,18 @@ class NotifySlack(NotifyBase):
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
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
notify_url = 'https://hooks.slack.com/services'

View File

@ -61,10 +61,18 @@ class NotifyStride(NotifyBase):
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
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
notify_url = 'https://api.atlassian.com/site/{cloud_id}/' \
'conversation/{convo_id}/message'

View File

@ -81,10 +81,18 @@ class NotifyTelegram(NotifyBase):
"""
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
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
notify_url = 'https://api.telegram.org/bot'

View File

@ -34,9 +34,18 @@ class NotifyToasty(NotifyBase):
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
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
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
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
# This is used during a Private DM Message Size (not Public Tweets
# which are limited to 240 characters)

View File

@ -47,9 +47,15 @@ class NotifyWindows(NotifyBase):
A wrapper for local Windows Notifications
"""
# The default descriptive name associated with the Notification
service_name = 'Windows Notification'
# The default protocol
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
image_size = NotifyImageSize.XY_128

View File

@ -31,12 +31,21 @@ class NotifyXBMC(NotifyBase):
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
protocol = ('xbmc', 'kodi')
# The default secure protocols
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_default_port = 8080

View File

@ -30,12 +30,18 @@ class NotifyXML(NotifyBase):
A wrapper for XML Notifications
"""
# The default descriptive name associated with the Notification
service_name = 'XML'
# The default protocol
protocol = 'xml'
# The default secure protocol
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
image_size = NotifyImageSize.XY_128

View File

@ -22,6 +22,7 @@ from os import getuid
from os.path import dirname
from apprise import Apprise
from apprise import AppriseAsset
from apprise.utils import compat_is_basestring
from apprise.Apprise import SCHEMA_MAP
from apprise import NotifyBase
from apprise import NotifyType
@ -500,8 +501,6 @@ def test_apprise_details():
assert isinstance(details.get('schemas'), list)
# We have an entry per defined plugin
assert len(details.get('schemas')) == len(dir(plugins))
assert 'asset' in details
assert isinstance(details.get('asset'), dict)
assert 'app_id' in details['asset']
@ -511,3 +510,8 @@ def test_apprise_details():
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'])]))