From a8dd670af813053e9b6531d5e216b2df8624e162 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Matthies?= Date: Wed, 12 Mar 2025 12:55:49 +0100 Subject: [PATCH] add option 'label' for plugin seven --- apprise/plugins/seven.py | 16 ++++++++++++++-- test/test_plugin_seven.py | 4 ++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/apprise/plugins/seven.py b/apprise/plugins/seven.py index c6174b48..1e6732eb 100644 --- a/apprise/plugins/seven.py +++ b/apprise/plugins/seven.py @@ -113,10 +113,14 @@ class NotifySeven(NotifyBase): 'type': 'bool', 'default': False, }, + 'label': { + 'name': _('Label'), + 'type': 'string' + }, }) def __init__(self, apikey, targets=None, source=None, flash=None, - **kwargs): + label=None, **kwargs): """ Initialize Seven Object """ @@ -133,6 +137,8 @@ class NotifySeven(NotifyBase): if not isinstance(source, str) else source.strip() self.flash = self.template_args['flash']['default'] \ if flash is None else bool(flash) + self.label = None \ + if not isinstance(label, str) else label.strip() # Parse our targets self.targets = list() @@ -154,7 +160,7 @@ class NotifySeven(NotifyBase): def url_identifier(self): """ Returns all of the identifiers that make this URL unique from - another simliar one. Targets or end points should never be identified + another similar one. Targets or end points should never be identified here. """ return (self.secure_protocol, self.apikey) @@ -189,6 +195,8 @@ class NotifySeven(NotifyBase): payload['from'] = self.source if self.flash: payload['flash'] = self.flash + if self.label: + payload['label'] = self.label # Create a copy of the targets list targets = list(self.targets) while len(targets): @@ -278,6 +286,8 @@ class NotifySeven(NotifyBase): } if self.source: params['from'] = self.source + if self.label: + params['label'] = self.label # Our URL parameters params = self.url_parameters(privacy=privacy, *args, **kwargs) @@ -332,5 +342,7 @@ class NotifySeven(NotifyBase): results['flash'] = \ parse_bool(results['qsd'].get('flash', False)) + results['label'] = \ + results['qsd'].get('label', None) return results diff --git a/test/test_plugin_seven.py b/test/test_plugin_seven.py index 6f742a23..b27e343a 100644 --- a/test/test_plugin_seven.py +++ b/test/test_plugin_seven.py @@ -93,6 +93,10 @@ apprise_url_tests = ( # valid number, utilizing the optional source= variable (same as from) 'instance': NotifySeven, }), + ('seven://{}/15551232000?source=AR&flash=1&label=123'.format('3' * 14), { + # valid number, utilizing the optional source= variable (same as from) + 'instance': NotifySeven, + }), )