summaryrefslogtreecommitdiffhomepage
path: root/libs/apprise/URLBase.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/URLBase.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/URLBase.py')
-rw-r--r--libs/apprise/URLBase.py44
1 files changed, 40 insertions, 4 deletions
diff --git a/libs/apprise/URLBase.py b/libs/apprise/URLBase.py
index 78109ae48..f5428dbb1 100644
--- a/libs/apprise/URLBase.py
+++ b/libs/apprise/URLBase.py
@@ -25,7 +25,7 @@
import re
import six
-import logging
+from .logger import logger
from time import sleep
from datetime import datetime
from xml.sax.saxutils import escape as sax_escape
@@ -47,6 +47,7 @@ from .AppriseAsset import AppriseAsset
from .utils import parse_url
from .utils import parse_bool
from .utils import parse_list
+from .utils import parse_phone_no
# Used to break a path list into parts
PATHSPLIT_LIST_DELIM = re.compile(r'[ \t\r\n,\\/]+')
@@ -115,8 +116,8 @@ class URLBase(object):
# Secure sites should be verified against a Certificate Authority
verify_certificate = True
- # Logging
- logger = logging.getLogger(__name__)
+ # Logging to our global logger
+ logger = logger
# Define a default set of template arguments used for dynamically building
# details about our individual plugins for developers.
@@ -280,7 +281,7 @@ class URLBase(object):
self._last_io_datetime = reference
return
- if self.request_rate_per_sec <= 0.0:
+ if self.request_rate_per_sec <= 0.0 and not wait:
# We're done if there is no throttle limit set
return
@@ -560,6 +561,39 @@ class URLBase(object):
return content
+ @staticmethod
+ def parse_phone_no(content, unquote=True):
+ """A wrapper to utils.parse_phone_no() with unquoting support
+
+ Parses a specified set of data and breaks it into a list.
+
+ Args:
+ content (str): The path to split up into a list. If a list is
+ provided, then it's individual entries are processed.
+
+ unquote (:obj:`bool`, optional): call unquote on each element
+ added to the returned list.
+
+ Returns:
+ list: A unique list containing all of the elements in the path
+ """
+
+ if unquote:
+ try:
+ content = URLBase.unquote(content)
+ except TypeError:
+ # Nothing further to do
+ return []
+
+ except AttributeError:
+ # This exception ONLY gets thrown under Python v2.7 if an
+ # object() is passed in place of the content
+ return []
+
+ content = parse_phone_no(content)
+
+ return content
+
@property
def app_id(self):
return self.asset.app_id if self.asset.app_id else ''
@@ -636,6 +670,8 @@ class URLBase(object):
results['qsd'].get('verify', True))
# Password overrides
+ if 'password' in results['qsd']:
+ results['password'] = results['qsd']['password']
if 'pass' in results['qsd']:
results['password'] = results['qsd']['pass']