aboutsummaryrefslogtreecommitdiffhomepage
path: root/libs/apprise/plugins/NotifySimplePush.py
diff options
context:
space:
mode:
authormorpheus65535 <[email protected]>2021-12-01 21:19:18 -0500
committermorpheus65535 <[email protected]>2021-12-01 21:19:18 -0500
commitd51dc68ebb3910ca09bb40c33814d43b93d916b8 (patch)
tree569807abb70b41eb98dded56c17bd504e793da5b /libs/apprise/plugins/NotifySimplePush.py
parent402c82d84f7bd51353348bea7d1a876ad9ecc5b1 (diff)
downloadbazarr-d51dc68ebb3910ca09bb40c33814d43b93d916b8.tar.gz
bazarr-d51dc68ebb3910ca09bb40c33814d43b93d916b8.zip
Updated Apprise notification module to the latest providers.v1.0.2-beta.2
Diffstat (limited to 'libs/apprise/plugins/NotifySimplePush.py')
-rw-r--r--libs/apprise/plugins/NotifySimplePush.py33
1 files changed, 15 insertions, 18 deletions
diff --git a/libs/apprise/plugins/NotifySimplePush.py b/libs/apprise/plugins/NotifySimplePush.py
index dd192e794..400216e72 100644
--- a/libs/apprise/plugins/NotifySimplePush.py
+++ b/libs/apprise/plugins/NotifySimplePush.py
@@ -32,8 +32,8 @@ from ..common import NotifyType
from ..utils import validate_regex
from ..AppriseLocale import gettext_lazy as _
-# Default our global support flag
-CRYPTOGRAPHY_AVAILABLE = False
+from base64 import urlsafe_b64encode
+import hashlib
try:
from cryptography.hazmat.primitives import padding
@@ -41,15 +41,13 @@ try:
from cryptography.hazmat.primitives.ciphers import algorithms
from cryptography.hazmat.primitives.ciphers import modes
from cryptography.hazmat.backends import default_backend
- from base64 import urlsafe_b64encode
- import hashlib
- CRYPTOGRAPHY_AVAILABLE = True
+ # We're good to go!
+ NOTIFY_SIMPLEPUSH_ENABLED = True
except ImportError:
- # no problem; this just means the added encryption functionality isn't
- # available. You can still send a SimplePush message
- pass
+ # cryptography is required in order for this package to work
+ NOTIFY_SIMPLEPUSH_ENABLED = False
class NotifySimplePush(NotifyBase):
@@ -57,6 +55,14 @@ class NotifySimplePush(NotifyBase):
A wrapper for SimplePush Notifications
"""
+ # Set our global enabled flag
+ enabled = NOTIFY_SIMPLEPUSH_ENABLED
+
+ requirements = {
+ # Define our required packaging in order to work
+ 'packages_required': 'cryptography'
+ }
+
# The default descriptive name associated with the Notification
service_name = 'SimplePush'
@@ -181,15 +187,6 @@ class NotifySimplePush(NotifyBase):
Perform SimplePush Notification
"""
- # Encrypt Message (providing support is available)
- if self.password and self.user and not CRYPTOGRAPHY_AVAILABLE:
- # Provide the end user at least some notification that they're
- # not getting what they asked for
- self.logger.warning(
- "Authenticated SimplePush Notifications are not supported by "
- "this system; `pip install cryptography`.")
- return False
-
headers = {
'User-Agent': self.app_id,
'Content-type': "application/x-www-form-urlencoded",
@@ -200,7 +197,7 @@ class NotifySimplePush(NotifyBase):
'key': self.apikey,
}
- if self.password and self.user and CRYPTOGRAPHY_AVAILABLE:
+ if self.password and self.user:
body = self._encrypt(body)
title = self._encrypt(title)
payload.update({