mirror of
https://github.com/caronc/apprise.git
synced 2024-11-21 23:53:23 +01:00
Deprication Cleanup and Code Tidy (#593)
This commit is contained in:
parent
6ac9c1d89a
commit
9ef8e72952
6
.github/PULL_REQUEST_TEMPLATE.md
vendored
6
.github/PULL_REQUEST_TEMPLATE.md
vendored
@ -6,8 +6,8 @@
|
||||
## New Service Completion Status
|
||||
<!-- This section is only applicable if you're adding a new service -->
|
||||
* [ ] apprise/plugins/Notify<!--ServiceName goes here-->.py
|
||||
* [ ] setup.py
|
||||
- add new service into the `KEYWORDS` file located in the root directory
|
||||
* [ ] KEYWORDS
|
||||
- add new service into this file (alphabetically).
|
||||
* [ ] README.md
|
||||
- add entry for new service to table (as a quick reference)
|
||||
* [ ] packaging/redhat/python-apprise.spec
|
||||
@ -37,7 +37,7 @@ source bin/activate
|
||||
# Install the branch
|
||||
pip install git+https://github.com/caronc/apprise.git@<this.branch-name>
|
||||
|
||||
# Be sure you're running your Signal API Server and query it like so
|
||||
# Test out the changes with the following command:
|
||||
apprise -t "Test Title" -b "Test Message" \
|
||||
<apprise url related to ticket>
|
||||
|
||||
|
@ -24,3 +24,6 @@ The contributors have been listed in chronological order:
|
||||
|
||||
* Andreas Motl <andreas@getkotori.org>
|
||||
* Mar 2020 - Fix XMPP Support
|
||||
|
||||
* Joey Espinosa <@particledecay>
|
||||
* Apr 3rd 2022 - Added Ntfy Support
|
||||
|
@ -339,18 +339,10 @@ class NotifyAppriseAPI(NotifyBase):
|
||||
return results
|
||||
|
||||
# Add our headers that the user can potentially over-ride if they wish
|
||||
# to to our returned result set
|
||||
results['headers'] = results['qsd+']
|
||||
if results['qsd-']:
|
||||
results['headers'].update(results['qsd-'])
|
||||
NotifyBase.logger.deprecate(
|
||||
"minus (-) based Apprise API header tokens are being "
|
||||
" removed; use the plus (+) symbol instead.")
|
||||
|
||||
# Tidy our header entries by unquoting them
|
||||
# to to our returned result set and tidy entries by unquoting them
|
||||
results['headers'] = \
|
||||
{NotifyAppriseAPI.unquote(x): NotifyAppriseAPI.unquote(y)
|
||||
for x, y in results['headers'].items()}
|
||||
for x, y in results['qsd+'].items()}
|
||||
|
||||
# Support the passing of tags in the URL
|
||||
if 'tags' in results['qsd'] and len(results['qsd']['tags']):
|
||||
|
@ -357,13 +357,8 @@ class NotifyBoxcar(NotifyBase):
|
||||
# by default
|
||||
entries = NotifyBoxcar.split_path(results['fullpath'])
|
||||
|
||||
try:
|
||||
# Now fetch the remaining tokens
|
||||
results['secret'] = entries.pop(0)
|
||||
|
||||
except IndexError:
|
||||
# secret wasn't specified
|
||||
results['secret'] = None
|
||||
results['secret'] = entries.pop(0) if entries else None
|
||||
|
||||
# Our recipients make up the remaining entries of our array
|
||||
results['targets'] = entries
|
||||
|
@ -901,13 +901,6 @@ class NotifyEmail(NotifyBase):
|
||||
# Extract from name to associate with from address
|
||||
results['from_name'] = NotifyEmail.unquote(results['qsd']['name'])
|
||||
|
||||
if 'timeout' in results['qsd'] and len(results['qsd']['timeout']):
|
||||
# Deprecated in favor of cto= flag
|
||||
NotifyBase.logger.deprecate(
|
||||
"timeout= argument is deprecated; use cto= instead.")
|
||||
results['qsd']['cto'] = results['qsd']['timeout']
|
||||
del results['qsd']['timeout']
|
||||
|
||||
# Store SMTP Host if specified
|
||||
if 'smtp' in results['qsd'] and len(results['qsd']['smtp']):
|
||||
# Extract the smtp server
|
||||
|
@ -337,18 +337,10 @@ class NotifyEnigma2(NotifyBase):
|
||||
return results
|
||||
|
||||
# Add our headers that the user can potentially over-ride if they wish
|
||||
# to to our returned result set
|
||||
results['headers'] = results['qsd+']
|
||||
if results['qsd-']:
|
||||
results['headers'].update(results['qsd-'])
|
||||
NotifyBase.logger.deprecate(
|
||||
"minus (-) based Enigma header tokens are being "
|
||||
" removed; use the plus (+) symbol instead.")
|
||||
|
||||
# Tidy our header entries by unquoting them
|
||||
# to to our returned result set and tidy entries by unquoting them
|
||||
results['headers'] = {
|
||||
NotifyEnigma2.unquote(x): NotifyEnigma2.unquote(y)
|
||||
for x, y in results['headers'].items()}
|
||||
for x, y in results['qsd+'].items()}
|
||||
|
||||
# Save timeout value (if specified)
|
||||
if 'timeout' in results['qsd'] and len(results['qsd']['timeout']):
|
||||
|
@ -374,17 +374,9 @@ class NotifyForm(NotifyBase):
|
||||
for x, y in results['qsd:'].items()}
|
||||
|
||||
# Add our headers that the user can potentially over-ride if they wish
|
||||
# to to our returned result set
|
||||
results['headers'] = results['qsd+']
|
||||
if results['qsd-']:
|
||||
results['headers'].update(results['qsd-'])
|
||||
NotifyBase.logger.deprecate(
|
||||
"minus (-) based Form header tokens are being "
|
||||
" removed; use the plus (+) symbol instead.")
|
||||
|
||||
# Tidy our header entries by unquoting them
|
||||
# to to our returned result set and tidy entries by unquoting them
|
||||
results['headers'] = {NotifyForm.unquote(x): NotifyForm.unquote(y)
|
||||
for x, y in results['headers'].items()}
|
||||
for x, y in results['qsd+'].items()}
|
||||
|
||||
# Set method if not otherwise set
|
||||
if 'method' in results['qsd'] and len(results['qsd']['method']):
|
||||
|
@ -361,17 +361,9 @@ class NotifyJSON(NotifyBase):
|
||||
for x, y in results['qsd:'].items()}
|
||||
|
||||
# Add our headers that the user can potentially over-ride if they wish
|
||||
# to to our returned result set
|
||||
results['headers'] = results['qsd+']
|
||||
if results['qsd-']:
|
||||
results['headers'].update(results['qsd-'])
|
||||
NotifyBase.logger.deprecate(
|
||||
"minus (-) based JSON header tokens are being "
|
||||
" removed; use the plus (+) symbol instead.")
|
||||
|
||||
# Tidy our header entries by unquoting them
|
||||
# to to our returned result set and tidy entries by unquoting them
|
||||
results['headers'] = {NotifyJSON.unquote(x): NotifyJSON.unquote(y)
|
||||
for x, y in results['headers'].items()}
|
||||
for x, y in results['qsd+'].items()}
|
||||
|
||||
# Set method if not otherwise set
|
||||
if 'method' in results['qsd'] and len(results['qsd']['method']):
|
||||
|
@ -331,13 +331,10 @@ class NotifyNextcloud(NotifyBase):
|
||||
results['version'] = \
|
||||
NotifyNextcloud.unquote(results['qsd']['version'])
|
||||
|
||||
# Add our headers that the user can potentially over-ride if they
|
||||
# wish to to our returned result set
|
||||
results['headers'] = results['qsd+']
|
||||
if results['qsd-']:
|
||||
results['headers'].update(results['qsd-'])
|
||||
NotifyBase.logger.deprecate(
|
||||
"minus (-) based Nextcloud header tokens are being "
|
||||
" removed; use the plus (+) symbol instead.")
|
||||
# Add our headers that the user can potentially over-ride if they wish
|
||||
# to to our returned result set and tidy entries by unquoting them
|
||||
results['headers'] = {
|
||||
NotifyNextcloud.unquote(x): NotifyNextcloud.unquote(y)
|
||||
for x, y in results['qsd+'].items()}
|
||||
|
||||
return results
|
||||
|
@ -269,13 +269,10 @@ class NotifyNextcloudTalk(NotifyBase):
|
||||
results['targets'] = \
|
||||
NotifyNextcloudTalk.split_path(results['fullpath'])
|
||||
|
||||
# Add our headers that the user can potentially over-ride if they
|
||||
# wish to to our returned result set
|
||||
results['headers'] = results['qsd+']
|
||||
if results['qsd-']:
|
||||
results['headers'].update(results['qsd-'])
|
||||
NotifyBase.logger.deprecate(
|
||||
"minus (-) based Nextcloud Talk header tokens are being "
|
||||
" removed; use the plus (+) symbol instead.")
|
||||
# Add our headers that the user can potentially over-ride if they wish
|
||||
# to to our returned result set and tidy entries by unquoting them
|
||||
results['headers'] = {
|
||||
NotifyNextcloudTalk.unquote(x): NotifyNextcloudTalk.unquote(y)
|
||||
for x, y in results['qsd+'].items()}
|
||||
|
||||
return results
|
||||
|
@ -364,13 +364,11 @@ class NotifyNotica(NotifyBase):
|
||||
'/' if not entries else '/{}/'.format('/'.join(entries))
|
||||
|
||||
# Add our headers that the user can potentially over-ride if they
|
||||
# wish to to our returned result set
|
||||
results['headers'] = results['qsd+']
|
||||
if results['qsd-']:
|
||||
results['headers'].update(results['qsd-'])
|
||||
NotifyBase.logger.deprecate(
|
||||
"minus (-) based Notica header tokens are being "
|
||||
" removed; use the plus (+) symbol instead.")
|
||||
# wish to to our returned result set and tidy entries by unquoting
|
||||
# them
|
||||
results['headers'] = {
|
||||
NotifyNotica.unquote(x): NotifyNotica.unquote(y)
|
||||
for x, y in results['qsd+'].items()}
|
||||
|
||||
return results
|
||||
|
||||
|
@ -1,24 +1,31 @@
|
||||
# MIT License
|
||||
|
||||
# Copyright (c) 2022 Joey Espinosa <@particledecay>
|
||||
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright (C) 2022 Chris Caron <lead2gold@gmail.com>
|
||||
# All rights reserved.
|
||||
#
|
||||
# This code is licensed under the MIT License.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files(the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions :
|
||||
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
|
||||
# Great sources
|
||||
# - https://github.com/matrix-org/matrix-python-sdk
|
||||
# - https://github.com/matrix-org/synapse/blob/master/docs/reverse_proxy.rst
|
||||
#
|
||||
# Examples:
|
||||
# ntfys://my-topic
|
||||
|
@ -1,6 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright (C) 2021 <example@example.com>
|
||||
# Copyright (C) 2021 Chris Caron <lead2gold@gmail.com>
|
||||
# All rights reserved.
|
||||
#
|
||||
# This code is licensed under the MIT License.
|
||||
|
@ -414,17 +414,9 @@ class NotifyXML(NotifyBase):
|
||||
for x, y in results['qsd:'].items()}
|
||||
|
||||
# Add our headers that the user can potentially over-ride if they wish
|
||||
# to to our returned result set
|
||||
results['headers'] = results['qsd+']
|
||||
if results['qsd-']:
|
||||
results['headers'].update(results['qsd-'])
|
||||
NotifyBase.logger.deprecate(
|
||||
"minus (-) based XML header tokens are being "
|
||||
"removed; use the plus (+) symbol instead.")
|
||||
|
||||
# Tidy our header entries by unquoting them
|
||||
# to to our returned result set and tidy entries by unquoting them
|
||||
results['headers'] = {NotifyXML.unquote(x): NotifyXML.unquote(y)
|
||||
for x, y in results['headers'].items()}
|
||||
for x, y in results['qsd+'].items()}
|
||||
|
||||
# Set method if not otherwise set
|
||||
if 'method' in results['qsd'] and len(results['qsd']['method']):
|
||||
|
@ -1,4 +1,27 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright (C) 2022 Chris Caron <lead2gold@gmail.com>
|
||||
# All rights reserved.
|
||||
#
|
||||
# This code is licensed under the MIT License.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files(the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions :
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
|
||||
import ssl
|
||||
from os.path import isfile
|
||||
|
@ -132,7 +132,7 @@ apprise_url_tests = (
|
||||
# Our expected url(privacy=True) startswith() response:
|
||||
'privacy_url': 'apprises://user:****@localhost:8080/m...5/',
|
||||
}),
|
||||
('apprises://localhost:8080/path?-HeaderKey=HeaderValue', {
|
||||
('apprises://localhost:8080/path?+HeaderKey=HeaderValue', {
|
||||
'instance': plugins.NotifyAppriseAPI,
|
||||
}),
|
||||
('apprise://localhost/%s' % ('a' * 32), {
|
||||
|
@ -112,7 +112,7 @@ apprise_url_tests = (
|
||||
# Our expected url(privacy=True) startswith() response:
|
||||
'privacy_url': 'forms://user:****@localhost:8080',
|
||||
}),
|
||||
('form://localhost:8080/path?-HeaderKey=HeaderValue', {
|
||||
('form://localhost:8080/path?+HeaderKey=HeaderValue', {
|
||||
'instance': plugins.NotifyForm,
|
||||
}),
|
||||
('form://user:pass@localhost:8081', {
|
||||
|
@ -100,7 +100,7 @@ apprise_url_tests = (
|
||||
# Our expected url(privacy=True) startswith() response:
|
||||
'privacy_url': 'jsons://user:****@localhost:8080',
|
||||
}),
|
||||
('json://localhost:8080/path?-HeaderKey=HeaderValue', {
|
||||
('json://localhost:8080/path?+HeaderKey=HeaderValue', {
|
||||
'instance': plugins.NotifyJSON,
|
||||
}),
|
||||
('json://user:pass@localhost:8081', {
|
||||
|
@ -125,7 +125,7 @@ apprise_url_tests = (
|
||||
('xmls://user:pass@localhost:8080', {
|
||||
'instance': plugins.NotifyXML,
|
||||
}),
|
||||
('xml://localhost:8080/path?-HeaderKey=HeaderValue', {
|
||||
('xml://localhost:8080/path?+HeaderKey=HeaderValue', {
|
||||
'instance': plugins.NotifyXML,
|
||||
}),
|
||||
('xml://user:pass@localhost:8081', {
|
||||
|
@ -113,18 +113,6 @@ TEST_URLS = (
|
||||
('mailtos://user:pass@nuxref.com:567/l2g@nuxref.com', {
|
||||
'instance': plugins.NotifyEmail,
|
||||
}),
|
||||
(
|
||||
'mailtos://user:pass@example.com?smtp=smtp.example.com&timeout=5'
|
||||
'&name=l2g&from=noreply@example.com', {
|
||||
'instance': plugins.NotifyEmail,
|
||||
},
|
||||
),
|
||||
('mailto://user:pass@example.com?timeout=invalid.entry', {
|
||||
'instance': plugins.NotifyEmail,
|
||||
}),
|
||||
('mailto://user:pass@example.com?timeout=invalid.entry', {
|
||||
'instance': plugins.NotifyEmail,
|
||||
}),
|
||||
(
|
||||
'mailto://user:pass@example.com:2525?user=l2g@example.com'
|
||||
'&pass=l2g@apprise!is!Awesome', {
|
||||
|
@ -144,7 +144,7 @@ apprise_url_tests = (
|
||||
'result': True
|
||||
},
|
||||
}),
|
||||
('enigma2://localhost:8080/path?-HeaderKey=HeaderValue', {
|
||||
('enigma2://localhost:8080/path?+HeaderKey=HeaderValue', {
|
||||
'instance': plugins.NotifyEnigma2,
|
||||
'requests_response_text': {
|
||||
'result': True
|
||||
|
@ -96,7 +96,7 @@ apprise_url_tests = (
|
||||
('nclouds://user:pass@localhost:8080/admin/', {
|
||||
'instance': plugins.NotifyNextcloud,
|
||||
}),
|
||||
('ncloud://localhost:8080/admin?-HeaderKey=HeaderValue', {
|
||||
('ncloud://localhost:8080/admin?+HeaderKey=HeaderValue', {
|
||||
'instance': plugins.NotifyNextcloud,
|
||||
}),
|
||||
('ncloud://user:pass@localhost:8081/admin', {
|
||||
|
@ -85,7 +85,7 @@ apprise_url_tests = (
|
||||
'instance': plugins.NotifyNextcloudTalk,
|
||||
'requests_response_code': requests.codes.created,
|
||||
}),
|
||||
('nctalk://user:pass@localhost:8080/roomid?-HeaderKey=HeaderValue', {
|
||||
('nctalk://user:pass@localhost:8080/roomid?+HeaderKey=HeaderValue', {
|
||||
'instance': plugins.NotifyNextcloudTalk,
|
||||
'requests_response_code': requests.codes.created,
|
||||
}),
|
||||
|
@ -110,10 +110,6 @@ apprise_url_tests = (
|
||||
('notica://localhost:8080//%s/?+HeaderKey=HeaderValue' % ('7' * 6), {
|
||||
'instance': plugins.NotifyNotica,
|
||||
}),
|
||||
# Test Depricated Header overrides
|
||||
('notica://localhost:8080//%s/?-HeaderKey=HeaderValue' % ('7' * 6), {
|
||||
'instance': plugins.NotifyNotica,
|
||||
}),
|
||||
('notica://%s' % ('c' * 6), {
|
||||
'instance': plugins.NotifyNotica,
|
||||
# force a failure
|
||||
|
Loading…
Reference in New Issue
Block a user