mirror of https://github.com/caronc/apprise
Merge 9bb0f7e828
into 91faed0c6d
commit
8fb7becad3
|
@ -41,7 +41,7 @@ from datetime import timezone
|
||||||
|
|
||||||
from ..base import NotifyBase
|
from ..base import NotifyBase
|
||||||
from ...url import PrivacyMode
|
from ...url import PrivacyMode
|
||||||
from ...common import NotifyFormat, NotifyType
|
from ...common import NotifyFormat, NotifyType, PersistentStoreMode
|
||||||
from ...conversion import convert_between
|
from ...conversion import convert_between
|
||||||
from ...utils import pgp as _pgp
|
from ...utils import pgp as _pgp
|
||||||
from ...utils.parse import (
|
from ...utils.parse import (
|
||||||
|
@ -75,6 +75,10 @@ class NotifyEmail(NotifyBase):
|
||||||
# Support attachments
|
# Support attachments
|
||||||
attachment_support = True
|
attachment_support = True
|
||||||
|
|
||||||
|
# Our default is to no not use persistent storage beyond in-memory
|
||||||
|
# reference; this allows us to auto-generate our config if needed
|
||||||
|
storage_mode = PersistentStoreMode.AUTO
|
||||||
|
|
||||||
# Default Notify Format
|
# Default Notify Format
|
||||||
notify_format = NotifyFormat.HTML
|
notify_format = NotifyFormat.HTML
|
||||||
|
|
||||||
|
|
|
@ -313,8 +313,8 @@ class NotifySlack(NotifyBase):
|
||||||
r'|(?:>|\>)))', re.IGNORECASE)
|
r'|(?:>|\>)))', re.IGNORECASE)
|
||||||
|
|
||||||
def __init__(self, access_token=None, token_a=None, token_b=None,
|
def __init__(self, access_token=None, token_a=None, token_b=None,
|
||||||
token_c=None, targets=None, include_image=True,
|
token_c=None, targets=None, include_image=None,
|
||||||
include_footer=True, use_blocks=None, **kwargs):
|
include_footer=None, use_blocks=None, **kwargs):
|
||||||
"""
|
"""
|
||||||
Initialize Slack Object
|
Initialize Slack Object
|
||||||
"""
|
"""
|
||||||
|
@ -386,10 +386,15 @@ class NotifySlack(NotifyBase):
|
||||||
re.IGNORECASE,
|
re.IGNORECASE,
|
||||||
)
|
)
|
||||||
# Place a thumbnail image inline with the message body
|
# Place a thumbnail image inline with the message body
|
||||||
self.include_image = include_image
|
self.include_image = \
|
||||||
|
self.template_args['image']['default'] \
|
||||||
|
if include_image is None else include_image
|
||||||
|
|
||||||
# Place a footer with each post
|
# Place a footer with each post
|
||||||
self.include_footer = include_footer
|
self.include_footer = \
|
||||||
|
self.template_args['footer']['default'] \
|
||||||
|
if include_footer is None else include_footer
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
def send(self, body, title='', notify_type=NotifyType.INFO, attach=None,
|
def send(self, body, title='', notify_type=NotifyType.INFO, attach=None,
|
||||||
|
@ -1150,7 +1155,8 @@ class NotifySlack(NotifyBase):
|
||||||
|
|
||||||
# Get Image Flag
|
# Get Image Flag
|
||||||
results['include_image'] = \
|
results['include_image'] = \
|
||||||
parse_bool(results['qsd'].get('image', True))
|
parse_bool(results['qsd'].get(
|
||||||
|
'image', NotifySlack.template_args['image']['default']))
|
||||||
|
|
||||||
# Get Payload structure (use blocks?)
|
# Get Payload structure (use blocks?)
|
||||||
if 'blocks' in results['qsd'] and len(results['qsd']['blocks']):
|
if 'blocks' in results['qsd'] and len(results['qsd']['blocks']):
|
||||||
|
@ -1158,7 +1164,8 @@ class NotifySlack(NotifyBase):
|
||||||
|
|
||||||
# Get Footer Flag
|
# Get Footer Flag
|
||||||
results['include_footer'] = \
|
results['include_footer'] = \
|
||||||
parse_bool(results['qsd'].get('footer', True))
|
parse_bool(results['qsd'].get(
|
||||||
|
'footer', NotifySlack.template_args['footer']['default']))
|
||||||
|
|
||||||
return results
|
return results
|
||||||
|
|
||||||
|
|
|
@ -117,7 +117,6 @@ class NotifySpike(NotifyBase):
|
||||||
"""
|
"""
|
||||||
Send Spike.sh Notification
|
Send Spike.sh Notification
|
||||||
"""
|
"""
|
||||||
self.throttle()
|
|
||||||
|
|
||||||
payload = {
|
payload = {
|
||||||
'message': title if title else body,
|
'message': title if title else body,
|
||||||
|
@ -129,6 +128,9 @@ class NotifySpike(NotifyBase):
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Always call throttle before any remote server i/o is made
|
||||||
|
self.throttle()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
response = requests.post(
|
response = requests.post(
|
||||||
self.webhook_url,
|
self.webhook_url,
|
||||||
|
|
|
@ -242,6 +242,12 @@ class NotifyWebexTeams(NotifyBase):
|
||||||
# We're done early as we couldn't load the results
|
# We're done early as we couldn't load the results
|
||||||
return results
|
return results
|
||||||
|
|
||||||
|
# Set our token if found as an argument
|
||||||
|
if 'token' in results['qsd'] and len(results['qsd']['token']):
|
||||||
|
results['token'] = \
|
||||||
|
NotifyWebexTeams.unquote(results['qsd']['token'])
|
||||||
|
|
||||||
|
else:
|
||||||
# The first token is stored in the hostname
|
# The first token is stored in the hostname
|
||||||
results['token'] = NotifyWebexTeams.unquote(results['host'])
|
results['token'] = NotifyWebexTeams.unquote(results['host'])
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
version: "3.3"
|
|
||||||
services:
|
services:
|
||||||
test.py39:
|
test.py39:
|
||||||
build:
|
build:
|
||||||
|
|
|
@ -120,7 +120,7 @@ def test_plugin_simplepush_urls():
|
||||||
@pytest.mark.skipif(
|
@pytest.mark.skipif(
|
||||||
'cryptography' in sys.modules,
|
'cryptography' in sys.modules,
|
||||||
reason="Requires that cryptography NOT be installed")
|
reason="Requires that cryptography NOT be installed")
|
||||||
def test_plugin_fcm_cryptography_import_error():
|
def test_plugin_simpepush_cryptography_import_error():
|
||||||
"""
|
"""
|
||||||
NotifySimplePush() Cryptography loading failure
|
NotifySimplePush() Cryptography loading failure
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -53,6 +53,13 @@ apprise_url_tests = (
|
||||||
# Our expected url(privacy=True) startswith() response:
|
# Our expected url(privacy=True) startswith() response:
|
||||||
'privacy_url': 'wxteams://a...a/',
|
'privacy_url': 'wxteams://a...a/',
|
||||||
}),
|
}),
|
||||||
|
('wxteams://?token={}'.format('a' * 80), {
|
||||||
|
# token provided - we're good
|
||||||
|
'instance': NotifyWebexTeams,
|
||||||
|
|
||||||
|
# Our expected url(privacy=True) startswith() response:
|
||||||
|
'privacy_url': 'wxteams://a...a/',
|
||||||
|
}),
|
||||||
('webex://{}'.format('a' * 140), {
|
('webex://{}'.format('a' * 140), {
|
||||||
# token provided - we're good
|
# token provided - we're good
|
||||||
'instance': NotifyWebexTeams,
|
'instance': NotifyWebexTeams,
|
||||||
|
|
Loading…
Reference in New Issue