From ab55aef0d01b7fec52fcc54fe6313b08420c7d76 Mon Sep 17 00:00:00 2001 From: Chris Caron Date: Sat, 24 Jun 2023 15:25:05 -0400 Subject: [PATCH] Inconsistent Notification Plugin Information Cleanup (#889) --- .gitignore | 4 ++++ apprise/plugins/NotifyBark.py | 3 ++- apprise/plugins/NotifyBoxcar.py | 16 +++++++++++++ apprise/plugins/NotifyBulkSMS.py | 3 +++ apprise/plugins/NotifyD7Networks.py | 1 + apprise/plugins/NotifyDingTalk.py | 9 ++++++-- apprise/plugins/NotifyEmail.py | 7 +++++- apprise/plugins/NotifyFCM/__init__.py | 2 +- apprise/plugins/NotifyFlock.py | 7 +++--- apprise/plugins/NotifyGitter.py | 8 ++++++- apprise/plugins/NotifyGotify.py | 1 - apprise/plugins/NotifyJoin.py | 1 - apprise/plugins/NotifyLametric.py | 2 +- apprise/plugins/NotifyLine.py | 1 + apprise/plugins/NotifyMSG91.py | 1 + apprise/plugins/NotifyMailgun.py | 7 +++++- apprise/plugins/NotifyMatrix.py | 2 +- apprise/plugins/NotifyMattermost.py | 6 ++--- apprise/plugins/NotifyNextcloud.py | 2 ++ apprise/plugins/NotifyNextcloudTalk.py | 5 +++++ apprise/plugins/NotifyNotica.py | 12 +++++----- apprise/plugins/NotifyOffice365.py | 7 +++++- apprise/plugins/NotifyOneSignal.py | 1 + apprise/plugins/NotifyPagerDuty.py | 2 +- apprise/plugins/NotifyPopcornNotify.py | 1 + apprise/plugins/NotifyReddit.py | 1 + apprise/plugins/NotifyRyver.py | 5 +++-- apprise/plugins/NotifySES.py | 1 + apprise/plugins/NotifySMSEagle.py | 2 ++ apprise/plugins/NotifySNS.py | 3 ++- apprise/plugins/NotifyServerChan.py | 2 +- apprise/plugins/NotifySimplePush.py | 4 ++-- apprise/plugins/NotifySlack.py | 9 +++----- apprise/plugins/NotifySpontit.py | 1 - apprise/plugins/NotifySyslog.py | 1 - apprise/plugins/NotifyTwist.py | 2 ++ apprise/plugins/NotifyTwitter.py | 1 + apprise/plugins/NotifyVoipms.py | 2 +- apprise/plugins/NotifyZulip.py | 1 + apprise/plugins/__init__.py | 31 ++++++++++++++++++++++---- test/test_api.py | 1 + test/test_plugin_boxcar.py | 6 +++++ 42 files changed, 140 insertions(+), 44 deletions(-) diff --git a/.gitignore b/.gitignore index b7ccab0e..174d28b3 100644 --- a/.gitignore +++ b/.gitignore @@ -27,6 +27,10 @@ sdist/ .installed.cfg *.egg +# Generated from Docker Instance +.bash_history +.python_history + # Installer logs pip-log.txt pip-delete-this-directory.txt diff --git a/apprise/plugins/NotifyBark.py b/apprise/plugins/NotifyBark.py index f1c6d7bf..596a9a87 100644 --- a/apprise/plugins/NotifyBark.py +++ b/apprise/plugins/NotifyBark.py @@ -127,10 +127,10 @@ class NotifyBark(NotifyBase): # Define object templates templates = ( + '{schema}://{host}/{targets}', '{schema}://{host}:{port}/{targets}', '{schema}://{user}:{password}@{host}/{targets}', '{schema}://{user}:{password}@{host}:{port}/{targets}', - '{schema}://{user}:{password}@{host}/{targets}', ) # Define our template arguments @@ -163,6 +163,7 @@ class NotifyBark(NotifyBase): 'targets': { 'name': _('Targets'), 'type': 'list:string', + 'required': True, }, }) diff --git a/apprise/plugins/NotifyBoxcar.py b/apprise/plugins/NotifyBoxcar.py index 8e7045c7..9a5e07d4 100644 --- a/apprise/plugins/NotifyBoxcar.py +++ b/apprise/plugins/NotifyBoxcar.py @@ -151,6 +151,12 @@ class NotifyBoxcar(NotifyBase): 'to': { 'alias_of': 'targets', }, + 'access': { + 'alias_of': 'access_key', + }, + 'secret': { + 'alias_of': 'secret_key', + }, }) def __init__(self, access, secret, targets=None, include_image=True, @@ -381,6 +387,16 @@ class NotifyBoxcar(NotifyBase): results['targets'] += \ NotifyBoxcar.parse_list(results['qsd'].get('to')) + # Access + if 'access' in results['qsd'] and results['qsd']['access']: + results['access'] = NotifyBoxcar.unquote( + results['qsd']['access'].strip()) + + # Secret + if 'secret' in results['qsd'] and results['qsd']['secret']: + results['secret'] = NotifyBoxcar.unquote( + results['qsd']['secret'].strip()) + # Include images with our message results['include_image'] = \ parse_bool(results['qsd'].get('image', True)) diff --git a/apprise/plugins/NotifyBulkSMS.py b/apprise/plugins/NotifyBulkSMS.py index 814badae..222936c6 100644 --- a/apprise/plugins/NotifyBulkSMS.py +++ b/apprise/plugins/NotifyBulkSMS.py @@ -121,11 +121,13 @@ class NotifyBulkSMS(NotifyBase): 'user': { 'name': _('User Name'), 'type': 'string', + 'required': True, }, 'password': { 'name': _('Password'), 'type': 'string', 'private': True, + 'required': True, }, 'target_phone': { 'name': _('Target Phone No'), @@ -144,6 +146,7 @@ class NotifyBulkSMS(NotifyBase): 'targets': { 'name': _('Targets'), 'type': 'list:string', + 'required': True, }, }) diff --git a/apprise/plugins/NotifyD7Networks.py b/apprise/plugins/NotifyD7Networks.py index 3d0ee8aa..654e0118 100644 --- a/apprise/plugins/NotifyD7Networks.py +++ b/apprise/plugins/NotifyD7Networks.py @@ -114,6 +114,7 @@ class NotifyD7Networks(NotifyBase): 'targets': { 'name': _('Targets'), 'type': 'list:string', + 'required': True, }, }) diff --git a/apprise/plugins/NotifyDingTalk.py b/apprise/plugins/NotifyDingTalk.py index ae2a9b49..0d03eb33 100644 --- a/apprise/plugins/NotifyDingTalk.py +++ b/apprise/plugins/NotifyDingTalk.py @@ -103,13 +103,18 @@ class NotifyDingTalk(NotifyBase): 'regex': (r'^[a-z0-9]+$', 'i'), }, 'secret': { - 'name': _('Token'), + 'name': _('Secret'), 'type': 'string', 'private': True, 'regex': (r'^[a-z0-9]+$', 'i'), }, - 'targets': { + 'target_phone_no': { 'name': _('Target Phone No'), + 'type': 'string', + 'map_to': 'targets', + }, + 'targets': { + 'name': _('Targets'), 'type': 'list:string', }, }) diff --git a/apprise/plugins/NotifyEmail.py b/apprise/plugins/NotifyEmail.py index 22cd351a..aadf027c 100644 --- a/apprise/plugins/NotifyEmail.py +++ b/apprise/plugins/NotifyEmail.py @@ -385,8 +385,13 @@ class NotifyEmail(NotifyBase): 'min': 1, 'max': 65535, }, + 'target_email': { + 'name': _('Target Email'), + 'type': 'string', + 'map_to': 'targets', + }, 'targets': { - 'name': _('Target Emails'), + 'name': _('Targets'), 'type': 'list:string', }, }) diff --git a/apprise/plugins/NotifyFCM/__init__.py b/apprise/plugins/NotifyFCM/__init__.py index d8857d34..828a6ac1 100644 --- a/apprise/plugins/NotifyFCM/__init__.py +++ b/apprise/plugins/NotifyFCM/__init__.py @@ -157,7 +157,6 @@ class NotifyFCM(NotifyBase): 'project': { 'name': _('Project ID'), 'type': 'string', - 'required': True, }, 'target_device': { 'name': _('Target Device'), @@ -173,6 +172,7 @@ class NotifyFCM(NotifyBase): 'targets': { 'name': _('Targets'), 'type': 'list:string', + 'required': True, }, }) diff --git a/apprise/plugins/NotifyFlock.py b/apprise/plugins/NotifyFlock.py index 60b337e8..0130df64 100644 --- a/apprise/plugins/NotifyFlock.py +++ b/apprise/plugins/NotifyFlock.py @@ -97,8 +97,8 @@ class NotifyFlock(NotifyBase): # Define object templates templates = ( '{schema}://{token}', - '{schema}://{user}@{token}', - '{schema}://{user}@{token}/{targets}', + '{schema}://{botname}@{token}', + '{schema}://{botname}@{token}/{targets}', '{schema}://{token}/{targets}', ) @@ -111,9 +111,10 @@ class NotifyFlock(NotifyBase): 'private': True, 'required': True, }, - 'user': { + 'botname': { 'name': _('Bot Name'), 'type': 'string', + 'map_to': 'user', }, 'to_user': { 'name': _('To User ID'), diff --git a/apprise/plugins/NotifyGitter.py b/apprise/plugins/NotifyGitter.py index 70e7ada6..32e0013c 100644 --- a/apprise/plugins/NotifyGitter.py +++ b/apprise/plugins/NotifyGitter.py @@ -122,9 +122,15 @@ class NotifyGitter(NotifyBase): 'required': True, 'regex': (r'^[a-z0-9]{40}$', 'i'), }, + 'target_room': { + 'name': _('Target Room'), + 'type': 'string', + 'map_to': 'targets', + }, 'targets': { - 'name': _('Rooms'), + 'name': _('Targets'), 'type': 'list:string', + 'required': True, }, }) diff --git a/apprise/plugins/NotifyGotify.py b/apprise/plugins/NotifyGotify.py index 37922568..29af8a05 100644 --- a/apprise/plugins/NotifyGotify.py +++ b/apprise/plugins/NotifyGotify.py @@ -134,7 +134,6 @@ class NotifyGotify(NotifyBase): 'type': 'string', 'map_to': 'fullpath', 'default': '/', - 'required': True, }, 'port': { 'name': _('Port'), diff --git a/apprise/plugins/NotifyJoin.py b/apprise/plugins/NotifyJoin.py index e6210a5f..7359df18 100644 --- a/apprise/plugins/NotifyJoin.py +++ b/apprise/plugins/NotifyJoin.py @@ -174,7 +174,6 @@ class NotifyJoin(NotifyBase): 'targets': { 'name': _('Targets'), 'type': 'list:string', - 'required': True, }, }) diff --git a/apprise/plugins/NotifyLametric.py b/apprise/plugins/NotifyLametric.py index 1b98b694..6850a888 100644 --- a/apprise/plugins/NotifyLametric.py +++ b/apprise/plugins/NotifyLametric.py @@ -370,6 +370,7 @@ class NotifyLametric(NotifyBase): # Device Mode '{schema}://{apikey}@{host}', + '{schema}://{user}:{apikey}@{host}', '{schema}://{apikey}@{host}:{port}', '{schema}://{user}:{apikey}@{host}:{port}', ) @@ -404,7 +405,6 @@ class NotifyLametric(NotifyBase): 'host': { 'name': _('Hostname'), 'type': 'string', - 'required': True, }, 'port': { 'name': _('Port'), diff --git a/apprise/plugins/NotifyLine.py b/apprise/plugins/NotifyLine.py index 817a998c..fe22619c 100644 --- a/apprise/plugins/NotifyLine.py +++ b/apprise/plugins/NotifyLine.py @@ -102,6 +102,7 @@ class NotifyLine(NotifyBase): 'targets': { 'name': _('Targets'), 'type': 'list:string', + 'required': True }, }) diff --git a/apprise/plugins/NotifyMSG91.py b/apprise/plugins/NotifyMSG91.py index 75834c39..2a08c883 100644 --- a/apprise/plugins/NotifyMSG91.py +++ b/apprise/plugins/NotifyMSG91.py @@ -133,6 +133,7 @@ class NotifyMSG91(NotifyBase): 'targets': { 'name': _('Targets'), 'type': 'list:string', + 'required': True, }, 'sender': { 'name': _('Sender ID'), diff --git a/apprise/plugins/NotifyMailgun.py b/apprise/plugins/NotifyMailgun.py index 3139e341..dd317185 100644 --- a/apprise/plugins/NotifyMailgun.py +++ b/apprise/plugins/NotifyMailgun.py @@ -152,8 +152,13 @@ class NotifyMailgun(NotifyBase): 'private': True, 'required': True, }, + 'target_email': { + 'name': _('Target Email'), + 'type': 'string', + 'map_to': 'targets', + }, 'targets': { - 'name': _('Target Emails'), + 'name': _('Targets'), 'type': 'list:string', }, }) diff --git a/apprise/plugins/NotifyMatrix.py b/apprise/plugins/NotifyMatrix.py index c0b524a0..acaa2fbe 100644 --- a/apprise/plugins/NotifyMatrix.py +++ b/apprise/plugins/NotifyMatrix.py @@ -175,7 +175,6 @@ class NotifyMatrix(NotifyBase): 'host': { 'name': _('Hostname'), 'type': 'string', - 'required': True, }, 'port': { 'name': _('Port'), @@ -194,6 +193,7 @@ class NotifyMatrix(NotifyBase): }, 'token': { 'name': _('Access Token'), + 'private': True, 'map_to': 'password', }, 'target_user': { diff --git a/apprise/plugins/NotifyMattermost.py b/apprise/plugins/NotifyMattermost.py index e62f653c..fa2592eb 100644 --- a/apprise/plugins/NotifyMattermost.py +++ b/apprise/plugins/NotifyMattermost.py @@ -91,11 +91,11 @@ class NotifyMattermost(NotifyBase): # Define object templates templates = ( '{schema}://{host}/{token}', - '{schema}://{host}/{token}:{port}', + '{schema}://{host}:{port}/{token}', + '{schema}://{host}/{fullpath}/{token}', + '{schema}://{host}:{port}/{fullpath}/{token}', '{schema}://{botname}@{host}/{token}', '{schema}://{botname}@{host}:{port}/{token}', - '{schema}://{host}/{fullpath}/{token}', - '{schema}://{host}/{fullpath}{token}:{port}', '{schema}://{botname}@{host}/{fullpath}/{token}', '{schema}://{botname}@{host}:{port}/{fullpath}/{token}', ) diff --git a/apprise/plugins/NotifyNextcloud.py b/apprise/plugins/NotifyNextcloud.py index 6bb79a7e..8e80bf5b 100644 --- a/apprise/plugins/NotifyNextcloud.py +++ b/apprise/plugins/NotifyNextcloud.py @@ -67,6 +67,8 @@ class NotifyNextcloud(NotifyBase): # Define object templates templates = ( + '{schema}://{host}/{targets}', + '{schema}://{host}:{port}/{targets}', '{schema}://{user}:{password}@{host}/{targets}', '{schema}://{user}:{password}@{host}:{port}/{targets}', ) diff --git a/apprise/plugins/NotifyNextcloudTalk.py b/apprise/plugins/NotifyNextcloudTalk.py index 8a1dc429..202cd746 100644 --- a/apprise/plugins/NotifyNextcloudTalk.py +++ b/apprise/plugins/NotifyNextcloudTalk.py @@ -96,6 +96,11 @@ class NotifyNextcloudTalk(NotifyBase): 'private': True, 'required': True, }, + 'target_room_id': { + 'name': _('Room ID'), + 'type': 'string', + 'map_to': 'targets', + }, 'targets': { 'name': _('Targets'), 'type': 'list:string', diff --git a/apprise/plugins/NotifyNotica.py b/apprise/plugins/NotifyNotica.py index 90bf7ef1..4d7ac460 100644 --- a/apprise/plugins/NotifyNotica.py +++ b/apprise/plugins/NotifyNotica.py @@ -112,12 +112,12 @@ class NotifyNotica(NotifyBase): '{schema}://{user}:{password}@{host}:{port}/{token}', # Self-hosted notica servers (with custom path) - '{schema}://{host}{path}{token}', - '{schema}://{host}:{port}{path}{token}', - '{schema}://{user}@{host}{path}{token}', - '{schema}://{user}@{host}:{port}{path}{token}', - '{schema}://{user}:{password}@{host}{path}{token}', - '{schema}://{user}:{password}@{host}:{port}{path}{token}', + '{schema}://{host}{path}/{token}', + '{schema}://{host}:{port}/{path}/{token}', + '{schema}://{user}@{host}/{path}/{token}', + '{schema}://{user}@{host}:{port}{path}/{token}', + '{schema}://{user}:{password}@{host}{path}/{token}', + '{schema}://{user}:{password}@{host}:{port}/{path}/{token}', ) # Define our template tokens diff --git a/apprise/plugins/NotifyOffice365.py b/apprise/plugins/NotifyOffice365.py index 658a2152..4d98df13 100644 --- a/apprise/plugins/NotifyOffice365.py +++ b/apprise/plugins/NotifyOffice365.py @@ -148,8 +148,13 @@ class NotifyOffice365(NotifyBase): 'private': True, 'required': True, }, + 'target_email': { + 'name': _('Target Email'), + 'type': 'string', + 'map_to': 'targets', + }, 'targets': { - 'name': _('Target Emails'), + 'name': _('Targets'), 'type': 'list:string', }, }) diff --git a/apprise/plugins/NotifyOneSignal.py b/apprise/plugins/NotifyOneSignal.py index ce56bbdd..471de44b 100644 --- a/apprise/plugins/NotifyOneSignal.py +++ b/apprise/plugins/NotifyOneSignal.py @@ -146,6 +146,7 @@ class NotifyOneSignal(NotifyBase): 'targets': { 'name': _('Targets'), 'type': 'list:string', + 'required': True, }, }) diff --git a/apprise/plugins/NotifyPagerDuty.py b/apprise/plugins/NotifyPagerDuty.py index a2417275..587e20a1 100644 --- a/apprise/plugins/NotifyPagerDuty.py +++ b/apprise/plugins/NotifyPagerDuty.py @@ -142,7 +142,7 @@ class NotifyPagerDuty(NotifyBase): }, # Optional but triggers V2 API 'integrationkey': { - 'name': _('Routing Key'), + 'name': _('Integration Key'), 'type': 'string', 'private': True, 'required': True diff --git a/apprise/plugins/NotifyPopcornNotify.py b/apprise/plugins/NotifyPopcornNotify.py index a36aed9f..ad5f13c0 100644 --- a/apprise/plugins/NotifyPopcornNotify.py +++ b/apprise/plugins/NotifyPopcornNotify.py @@ -93,6 +93,7 @@ class NotifyPopcornNotify(NotifyBase): 'targets': { 'name': _('Targets'), 'type': 'list:string', + 'required': True, } }) diff --git a/apprise/plugins/NotifyReddit.py b/apprise/plugins/NotifyReddit.py index ca8a846a..996ffd95 100644 --- a/apprise/plugins/NotifyReddit.py +++ b/apprise/plugins/NotifyReddit.py @@ -186,6 +186,7 @@ class NotifyReddit(NotifyBase): 'targets': { 'name': _('Targets'), 'type': 'list:string', + 'required': True, }, }) diff --git a/apprise/plugins/NotifyRyver.py b/apprise/plugins/NotifyRyver.py index b8b34a3c..ef29ad30 100644 --- a/apprise/plugins/NotifyRyver.py +++ b/apprise/plugins/NotifyRyver.py @@ -91,7 +91,7 @@ class NotifyRyver(NotifyBase): # Define object templates templates = ( '{schema}://{organization}/{token}', - '{schema}://{user}@{organization}/{token}', + '{schema}://{botname}@{organization}/{token}', ) # Define our template tokens @@ -109,9 +109,10 @@ class NotifyRyver(NotifyBase): 'private': True, 'regex': (r'^[A-Z0-9]{15}$', 'i'), }, - 'user': { + 'botname': { 'name': _('Bot Name'), 'type': 'string', + 'map_to': 'user', }, }) diff --git a/apprise/plugins/NotifySES.py b/apprise/plugins/NotifySES.py index 0610551b..6bc7295e 100644 --- a/apprise/plugins/NotifySES.py +++ b/apprise/plugins/NotifySES.py @@ -174,6 +174,7 @@ class NotifySES(NotifyBase): 'name': _('Region'), 'type': 'string', 'regex': (r'^[a-z]{2}-[a-z-]+?-[0-9]+$', 'i'), + 'required': True, 'map_to': 'region_name', }, 'targets': { diff --git a/apprise/plugins/NotifySMSEagle.py b/apprise/plugins/NotifySMSEagle.py index 747831e1..ac29838f 100644 --- a/apprise/plugins/NotifySMSEagle.py +++ b/apprise/plugins/NotifySMSEagle.py @@ -145,6 +145,7 @@ class NotifySMSEagle(NotifyBase): 'token': { 'name': _('Access Token'), 'type': 'string', + 'required': True, }, 'target_phone': { 'name': _('Target Phone No'), @@ -170,6 +171,7 @@ class NotifySMSEagle(NotifyBase): 'targets': { 'name': _('Targets'), 'type': 'list:string', + 'required': True, } }) diff --git a/apprise/plugins/NotifySNS.py b/apprise/plugins/NotifySNS.py index 1c7fead7..deb65433 100644 --- a/apprise/plugins/NotifySNS.py +++ b/apprise/plugins/NotifySNS.py @@ -103,7 +103,7 @@ class NotifySNS(NotifyBase): # Define object templates templates = ( - '{schema}://{access_key_id}/{secret_access_key}{region}/{targets}', + '{schema}://{access_key_id}/{secret_access_key}/{region}/{targets}', ) # Define our template tokens @@ -125,6 +125,7 @@ class NotifySNS(NotifyBase): 'type': 'string', 'required': True, 'regex': (r'^[a-z]{2}-[a-z-]+?-[0-9]+$', 'i'), + 'required': True, 'map_to': 'region_name', }, 'target_phone_no': { diff --git a/apprise/plugins/NotifyServerChan.py b/apprise/plugins/NotifyServerChan.py index 6fa8c557..dbd76bc6 100644 --- a/apprise/plugins/NotifyServerChan.py +++ b/apprise/plugins/NotifyServerChan.py @@ -68,7 +68,7 @@ class NotifyServerChan(NotifyBase): # Define object templates templates = ( - '{schema}://{token}/', + '{schema}://{token}', ) # Define our template tokens diff --git a/apprise/plugins/NotifySimplePush.py b/apprise/plugins/NotifySimplePush.py index 25066067..323bfa9e 100644 --- a/apprise/plugins/NotifySimplePush.py +++ b/apprise/plugins/NotifySimplePush.py @@ -109,12 +109,12 @@ class NotifySimplePush(NotifyBase): # Used for encrypted logins 'password': { - 'name': _('Encrypted Password'), + 'name': _('Password'), 'type': 'string', 'private': True, }, 'salt': { - 'name': _('Encrypted Salt'), + 'name': _('Salt'), 'type': 'string', 'private': True, 'map_to': 'user', diff --git a/apprise/plugins/NotifySlack.py b/apprise/plugins/NotifySlack.py index 0d85d25f..64038e74 100644 --- a/apprise/plugins/NotifySlack.py +++ b/apprise/plugins/NotifySlack.py @@ -165,10 +165,10 @@ class NotifySlack(NotifyBase): # Define object templates templates = ( # Webhook - '{schema}://{token_a}/{token_b}{token_c}', + '{schema}://{token_a}/{token_b}/{token_c}', '{schema}://{botname}@{token_a}/{token_b}{token_c}', - '{schema}://{token_a}/{token_b}{token_c}/{targets}', - '{schema}://{botname}@{token_a}/{token_b}{token_c}/{targets}', + '{schema}://{token_a}/{token_b}/{token_c}/{targets}', + '{schema}://{botname}@{token_a}/{token_b}/{token_c}/{targets}', # Bot '{schema}://{access_token}/', @@ -198,7 +198,6 @@ class NotifySlack(NotifyBase): 'name': _('Token A'), 'type': 'string', 'private': True, - 'required': True, 'regex': (r'^[A-Z0-9]+$', 'i'), }, # Token required as part of the Webhook request @@ -207,7 +206,6 @@ class NotifySlack(NotifyBase): 'name': _('Token B'), 'type': 'string', 'private': True, - 'required': True, 'regex': (r'^[A-Z0-9]+$', 'i'), }, # Token required as part of the Webhook request @@ -216,7 +214,6 @@ class NotifySlack(NotifyBase): 'name': _('Token C'), 'type': 'string', 'private': True, - 'required': True, 'regex': (r'^[A-Za-z0-9]+$', 'i'), }, 'target_encoded_id': { diff --git a/apprise/plugins/NotifySpontit.py b/apprise/plugins/NotifySpontit.py index 01d4e198..ad5d2016 100644 --- a/apprise/plugins/NotifySpontit.py +++ b/apprise/plugins/NotifySpontit.py @@ -135,7 +135,6 @@ class NotifySpontit(NotifyBase): 'targets': { 'name': _('Targets'), 'type': 'list:string', - 'required': True, }, }) diff --git a/apprise/plugins/NotifySyslog.py b/apprise/plugins/NotifySyslog.py index 433aab9c..23ac42b4 100644 --- a/apprise/plugins/NotifySyslog.py +++ b/apprise/plugins/NotifySyslog.py @@ -165,7 +165,6 @@ class NotifySyslog(NotifyBase): 'host': { 'name': _('Hostname'), 'type': 'string', - 'required': True, }, 'port': { 'name': _('Port'), diff --git a/apprise/plugins/NotifyTwist.py b/apprise/plugins/NotifyTwist.py index ea7b1976..be805a73 100644 --- a/apprise/plugins/NotifyTwist.py +++ b/apprise/plugins/NotifyTwist.py @@ -106,10 +106,12 @@ class NotifyTwist(NotifyBase): 'name': _('Password'), 'type': 'string', 'private': True, + 'required': True, }, 'email': { 'name': _('Email'), 'type': 'string', + 'required': True, }, 'target_channel': { 'name': _('Target Channel'), diff --git a/apprise/plugins/NotifyTwitter.py b/apprise/plugins/NotifyTwitter.py index 399c014a..9743a589 100644 --- a/apprise/plugins/NotifyTwitter.py +++ b/apprise/plugins/NotifyTwitter.py @@ -132,6 +132,7 @@ class NotifyTwitter(NotifyBase): ratelimit_remaining = 1 templates = ( + '{schema}://{ckey}/{csecret}/{akey}/{asecret}', '{schema}://{ckey}/{csecret}/{akey}/{asecret}/{targets}', ) diff --git a/apprise/plugins/NotifyVoipms.py b/apprise/plugins/NotifyVoipms.py index a4ec5ae1..ba19abbd 100644 --- a/apprise/plugins/NotifyVoipms.py +++ b/apprise/plugins/NotifyVoipms.py @@ -78,7 +78,6 @@ class NotifyVoipms(NotifyBase): # Define object templates templates = ( - '{schema}://{password}:{email}', '{schema}://{password}:{email}/{from_phone}/{targets}', ) @@ -111,6 +110,7 @@ class NotifyVoipms(NotifyBase): 'targets': { 'name': _('Targets'), 'type': 'list:string', + 'required': True, }, }) diff --git a/apprise/plugins/NotifyZulip.py b/apprise/plugins/NotifyZulip.py index f9521ae1..7b5eb9cc 100644 --- a/apprise/plugins/NotifyZulip.py +++ b/apprise/plugins/NotifyZulip.py @@ -131,6 +131,7 @@ class NotifyZulip(NotifyBase): 'name': _('Bot Name'), 'type': 'string', 'regex': (r'^[A-Z0-9_-]{1,32}$', 'i'), + 'required': True, }, 'organization': { 'name': _('Organization'), diff --git a/apprise/plugins/__init__.py b/apprise/plugins/__init__.py index 5560568b..b1114925 100644 --- a/apprise/plugins/__init__.py +++ b/apprise/plugins/__init__.py @@ -165,6 +165,9 @@ def _sanitize_token(tokens, default_delimiter): """ + # Used for tracking groups + group_map = {} + # Iterate over our tokens for key in tokens.keys(): @@ -181,14 +184,27 @@ def _sanitize_token(tokens, default_delimiter): # Default type to key tokens[key]['map_to'] = key + # Track our map_to objects + if tokens[key]['map_to'] not in group_map: + group_map[tokens[key]['map_to']] = set() + group_map[tokens[key]['map_to']].add(key) + if 'type' not in tokens[key]: # Default type to string tokens[key]['type'] = 'string' - elif tokens[key]['type'].startswith('list') \ - and 'delim' not in tokens[key]: - # Default list delimiter (if not otherwise specified) - tokens[key]['delim'] = default_delimiter + elif tokens[key]['type'].startswith('list'): + if 'delim' not in tokens[key]: + # Default list delimiter (if not otherwise specified) + tokens[key]['delim'] = default_delimiter + + if key in group_map[tokens[key]['map_to']]: # pragma: no branch + # Remove ourselves from the list + group_map[tokens[key]['map_to']].remove(key) + + # Pointing to the set directly so we can dynamically update + # ourselves + tokens[key]['group'] = group_map[tokens[key]['map_to']] elif tokens[key]['type'].startswith('choice') \ and 'default' not in tokens[key] \ @@ -266,6 +282,13 @@ def details(plugin): # # Identifies if the entry specified is required or not # 'required': True, # + # # Identifies all tokens detected to be associated with the + # # list:string + # # This is ony present in list:string objects and is only set + # # if this element acts as an alias for several other + # # kwargs/fields. + # 'group': [], + # # # Identify a default value # 'default': 'http', # diff --git a/test/test_api.py b/test/test_api.py index a9848b18..bc25a173 100644 --- a/test/test_api.py +++ b/test/test_api.py @@ -1486,6 +1486,7 @@ def test_apprise_details_plugin_verification(): valid_schema_keys = ( 'name', 'private', 'required', 'type', 'values', 'min', 'max', 'regex', 'default', 'list', 'delim', 'prefix', 'map_to', 'alias_of', + 'group', ) for entry in details['schemas']: diff --git a/test/test_plugin_boxcar.py b/test/test_plugin_boxcar.py index e0a696ec..32ceee58 100644 --- a/test/test_plugin_boxcar.py +++ b/test/test_plugin_boxcar.py @@ -89,6 +89,12 @@ apprise_url_tests = ( 'instance': NotifyBoxcar, 'requests_response_code': requests.codes.created, }), + ('boxcar://?access=%s&secret=%s&to=tag5' % ('d' * 64, 'b' * 64), { + # Test access and secret kwargs + 'privacy_url': 'boxcar://d...d/****/', + 'instance': NotifyBoxcar, + 'requests_response_code': requests.codes.created, + }), # An invalid tag ('boxcar://%s/%s/@%s' % ('a' * 64, 'b' * 64, 't' * 64), { 'instance': NotifyBoxcar,