diff --git a/KEYWORDS b/KEYWORDS index 84311f44..03140fca 100644 --- a/KEYWORDS +++ b/KEYWORDS @@ -17,7 +17,6 @@ Discord Email Emby Enigma2 -Faast FCM Flock Form diff --git a/README.md b/README.md index 0e66bba3..207b40cf 100644 --- a/README.md +++ b/README.md @@ -63,7 +63,6 @@ The table below identifies the services this tool supports and some example serv | [Discord](https://github.com/caronc/apprise/wiki/Notify_discord) | discord:// | (TCP) 443 | discord://webhook_id/webhook_token
discord://avatar@webhook_id/webhook_token | [Emby](https://github.com/caronc/apprise/wiki/Notify_emby) | emby:// or embys:// | (TCP) 8096 | emby://user@hostname/
emby://user:password@hostname | [Enigma2](https://github.com/caronc/apprise/wiki/Notify_enigma2) | enigma2:// or enigma2s:// | (TCP) 80 or 443 | enigma2://hostname -| [Faast](https://github.com/caronc/apprise/wiki/Notify_faast) | faast:// | (TCP) 443 | faast://authorizationtoken | [FCM](https://github.com/caronc/apprise/wiki/Notify_fcm) | fcm:// | (TCP) 443 | fcm://project@apikey/DEVICE_ID
fcm://project@apikey/#TOPIC
fcm://project@apikey/DEVICE_ID1/#topic1/#topic2/DEVICE_ID2/ | [Flock](https://github.com/caronc/apprise/wiki/Notify_flock) | flock:// | (TCP) 443 | flock://token
flock://botname@token
flock://app_token/u:userid
flock://app_token/g:channel_id
flock://app_token/u:userid/g:channel_id | [Google Chat](https://github.com/caronc/apprise/wiki/Notify_googlechat) | gchat:// | (TCP) 443 | gchat://workspace/key/token diff --git a/apprise/plugins/NotifyFaast.py b/apprise/plugins/NotifyFaast.py deleted file mode 100644 index f82c4402..00000000 --- a/apprise/plugins/NotifyFaast.py +++ /dev/null @@ -1,215 +0,0 @@ -# -*- coding: utf-8 -*- -# BSD 2-Clause License -# -# Apprise - Push Notification Library. -# Copyright (c) 2024, Chris Caron -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# 1. Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# -# 2. Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. - -import requests - -from .NotifyBase import NotifyBase -from ..common import NotifyImageSize -from ..common import NotifyType -from ..utils import parse_bool -from ..AppriseLocale import gettext_lazy as _ -from ..utils import validate_regex - - -class NotifyFaast(NotifyBase): - """ - 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) - 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 - notify_url = 'https://www.appnotifications.com/account/notifications.json' - - # Allows the user to specify the NotifyImageSize object - image_size = NotifyImageSize.XY_72 - - # Define object templates - templates = ( - '{schema}://{authtoken}', - ) - - # Define our template tokens - template_tokens = dict(NotifyBase.template_tokens, **{ - 'authtoken': { - 'name': _('Authorization Token'), - 'type': 'string', - 'private': True, - 'required': True, - }, - }) - - # Define our template arguments - template_args = dict(NotifyBase.template_args, **{ - 'image': { - 'name': _('Include Image'), - 'type': 'bool', - 'default': True, - 'map_to': 'include_image', - }, - }) - - def __init__(self, authtoken, include_image=True, **kwargs): - """ - Initialize Faast Object - """ - super().__init__(**kwargs) - - # Store the Authentication Token - self.authtoken = validate_regex(authtoken) - if not self.authtoken: - msg = 'An invalid Faast Authentication Token ' \ - '({}) was specified.'.format(authtoken) - self.logger.warning(msg) - raise TypeError(msg) - - # Associate an image with our post - self.include_image = include_image - - return - - def send(self, body, title='', notify_type=NotifyType.INFO, **kwargs): - """ - Perform Faast Notification - """ - - headers = { - 'User-Agent': self.app_id, - 'Content-Type': 'multipart/form-data' - } - - # prepare JSON Object - payload = { - 'user_credentials': self.authtoken, - 'title': title, - 'message': body, - } - - # Acquire our image if we're configured to do so - image_url = None if not self.include_image \ - else self.image_url(notify_type) - - if image_url: - payload['icon_url'] = image_url - - self.logger.debug('Faast POST URL: %s (cert_verify=%r)' % ( - self.notify_url, self.verify_certificate, - )) - self.logger.debug('Faast Payload: %s' % str(payload)) - - # Always call throttle before any remote server i/o is made - self.throttle() - - try: - r = requests.post( - self.notify_url, - data=payload, - headers=headers, - verify=self.verify_certificate, - timeout=self.request_timeout, - ) - if r.status_code != requests.codes.ok: - # We had a problem - status_str = \ - NotifyFaast.http_response_code_lookup(r.status_code) - - self.logger.warning( - 'Failed to send Faast notification:' - '{}{}error={}.'.format( - status_str, - ', ' if status_str else '', - r.status_code)) - - self.logger.debug('Response Details:\r\n{}'.format(r.content)) - - # Return; we're done - return False - - else: - self.logger.info('Sent Faast notification.') - - except requests.RequestException as e: - self.logger.warning( - 'A Connection error occurred sending Faast notification.', - ) - self.logger.debug('Socket Exception: %s' % str(e)) - - # Return; we're done - return False - - return True - - def url(self, privacy=False, *args, **kwargs): - """ - Returns the URL built dynamically based on specified arguments. - """ - - # Define any URL parameters - params = { - 'image': 'yes' if self.include_image else 'no', - } - - # Extend our parameters - params.update(self.url_parameters(privacy=privacy, *args, **kwargs)) - - return '{schema}://{authtoken}/?{params}'.format( - schema=self.protocol, - authtoken=self.pprint(self.authtoken, privacy, safe=''), - params=NotifyFaast.urlencode(params), - ) - - @staticmethod - def parse_url(url): - """ - Parses the URL and returns enough arguments that can allow - us to re-instantiate this object. - - """ - results = NotifyBase.parse_url(url, verify_host=False) - if not results: - # We're done early as we couldn't load the results - return results - - # Store our authtoken using the host - results['authtoken'] = NotifyFaast.unquote(results['host']) - - # Include image with our post - results['include_image'] = \ - parse_bool(results['qsd'].get('image', True)) - - return results diff --git a/packaging/redhat/python-apprise.spec b/packaging/redhat/python-apprise.spec index e698889e..9da28862 100644 --- a/packaging/redhat/python-apprise.spec +++ b/packaging/redhat/python-apprise.spec @@ -40,7 +40,7 @@ notification services that are out there. Apprise opens the door and makes it easy to access: Apprise API, APRS, AWS SES, AWS SNS, Bark, Boxcar, Burst SMS, BulkSMS, BulkVS, -ClickSend, DAPNET, DingTalk, Discord, E-Mail, Emby, Faast, FCM, Flock, +ClickSend, DAPNET, DingTalk, Discord, E-Mail, Emby, FCM, Flock, Free Mobile, Google Chat, Gotify, Growl, Guilded, Home Assistant, httpSMS, IFTTT, Join, Kavenegar, KODI, Kumulos, LaMetric, Line, LunaSea, MacOSX, Mailgun, Mastodon, Mattermost,Matrix, MessageBird, Microsoft Windows, diff --git a/test/test_api.py b/test/test_api.py index 10808879..793dee23 100644 --- a/test/test_api.py +++ b/test/test_api.py @@ -109,7 +109,7 @@ def apprise_test(do_notify): # We can load our servers up front as well servers = [ - 'faast://abcdefghijklmnop-abcdefg', + 'json://myhost', 'kodi://kodi.server.local', ] diff --git a/test/test_plugin_faast.py b/test/test_plugin_faast.py deleted file mode 100644 index db427a20..00000000 --- a/test/test_plugin_faast.py +++ /dev/null @@ -1,86 +0,0 @@ -# -*- coding: utf-8 -*- -# BSD 2-Clause License -# -# Apprise - Push Notification Library. -# Copyright (c) 2024, Chris Caron -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# 1. Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# -# 2. Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. - -import requests - -from apprise.plugins.NotifyFaast import NotifyFaast -from helpers import AppriseURLTester - -# Disable logging for a cleaner testing output -import logging -logging.disable(logging.CRITICAL) - -# Our Testing URLs -apprise_url_tests = ( - ('faast://', { - 'instance': TypeError, - }), - ('faast://:@/', { - 'instance': TypeError, - }), - # Auth Token specified - ('faast://%s' % ('a' * 32), { - 'instance': NotifyFaast, - - # Our expected url(privacy=True) startswith() response: - 'privacy_url': 'faast://a...a', - }), - ('faast://%s' % ('a' * 32), { - 'instance': NotifyFaast, - # don't include an image by default - 'include_image': False, - }), - ('faast://%s' % ('a' * 32), { - 'instance': NotifyFaast, - # force a failure - 'response': False, - 'requests_response_code': requests.codes.internal_server_error, - }), - ('faast://%s' % ('a' * 32), { - 'instance': NotifyFaast, - # throw a bizzare code forcing us to fail to look it up - 'response': False, - 'requests_response_code': 999, - }), - ('faast://%s' % ('a' * 32), { - 'instance': NotifyFaast, - # Throws a series of connection and transfer exceptions when this flag - # is set and tests that we gracfully handle them - 'test_requests_exceptions': True, - }), -) - - -def test_plugin_faast_urls(): - """ - NotifyFaast() Apprise URLs - - """ - - # Run our general tests - AppriseURLTester(tests=apprise_url_tests).run_all()