mirror of https://github.com/caronc/apprise
handling of cryptography when not available
parent
9b0a1ea527
commit
7d80aea78b
|
@ -32,7 +32,16 @@ from ...asset import AppriseAsset
|
||||||
from ...utils.base64 import base64_urldecode
|
from ...utils.base64 import base64_urldecode
|
||||||
from ...exception import AppriseInvalidData
|
from ...exception import AppriseInvalidData
|
||||||
from ...apprise_attachment import AppriseAttachment
|
from ...apprise_attachment import AppriseAttachment
|
||||||
from cryptography.hazmat.primitives.asymmetric import ec
|
|
||||||
|
try:
|
||||||
|
from cryptography.hazmat.primitives.asymmetric import ec
|
||||||
|
|
||||||
|
# Cryptography Support enabled
|
||||||
|
CRYPTOGRAPHY_SUPPORT = True
|
||||||
|
|
||||||
|
except ImportError:
|
||||||
|
# Cryptography Support disabled
|
||||||
|
CRYPTOGRAPHY_SUPPORT = False
|
||||||
|
|
||||||
|
|
||||||
class WebPushSubscription:
|
class WebPushSubscription:
|
||||||
|
@ -76,6 +85,9 @@ class WebPushSubscription:
|
||||||
self.__auth_secret = None
|
self.__auth_secret = None
|
||||||
self.__public_key = None
|
self.__public_key = None
|
||||||
|
|
||||||
|
if not CRYPTOGRAPHY_SUPPORT:
|
||||||
|
return False
|
||||||
|
|
||||||
if isinstance(content, str):
|
if isinstance(content, str):
|
||||||
try:
|
try:
|
||||||
content = json.loads(content)
|
content = json.loads(content)
|
||||||
|
|
Loading…
Reference in New Issue