handling of cryptography when not available

pull/1323/head
Chris Caron 2025-05-24 21:25:40 -04:00
parent 9b0a1ea527
commit 7d80aea78b
1 changed files with 13 additions and 1 deletions

View File

@ -32,8 +32,17 @@ from ...asset import AppriseAsset
from ...utils.base64 import base64_urldecode
from ...exception import AppriseInvalidData
from ...apprise_attachment import AppriseAttachment
try:
from cryptography.hazmat.primitives.asymmetric import ec
# Cryptography Support enabled
CRYPTOGRAPHY_SUPPORT = True
except ImportError:
# Cryptography Support disabled
CRYPTOGRAPHY_SUPPORT = False
class WebPushSubscription:
"""
@ -76,6 +85,9 @@ class WebPushSubscription:
self.__auth_secret = None
self.__public_key = None
if not CRYPTOGRAPHY_SUPPORT:
return False
if isinstance(content, str):
try:
content = json.loads(content)