summaryrefslogtreecommitdiffhomepage
path: root/libs/apprise/attachment
diff options
context:
space:
mode:
authorLouis Vézina <[email protected]>2020-09-14 08:24:26 -0400
committerLouis Vézina <[email protected]>2020-09-14 08:24:26 -0400
commite6b8b1ad195d553bca2ecff7e52f67ba4f5871ec (patch)
treefd56bb19e90afbf87bf845a74d69ca17cda0deff /libs/apprise/attachment
parentae731bb78b1d91b3e7f6017830c4014fae4aa6ff (diff)
downloadbazarr-e6b8b1ad195d553bca2ecff7e52f67ba4f5871ec.tar.gz
bazarr-e6b8b1ad195d553bca2ecff7e52f67ba4f5871ec.zip
Updated Apprise to 0.8.8
Diffstat (limited to 'libs/apprise/attachment')
-rw-r--r--libs/apprise/attachment/AttachFile.py12
-rw-r--r--libs/apprise/attachment/AttachHTTP.py32
2 files changed, 19 insertions, 25 deletions
diff --git a/libs/apprise/attachment/AttachFile.py b/libs/apprise/attachment/AttachFile.py
index 478e3d6f3..a8609bd60 100644
--- a/libs/apprise/attachment/AttachFile.py
+++ b/libs/apprise/attachment/AttachFile.py
@@ -57,20 +57,20 @@ class AttachFile(AttachBase):
Returns the URL built dynamically based on specified arguments.
"""
- # Define any arguments set
- args = {}
+ # Define any URL parameters
+ params = {}
if self._mimetype:
# A mime-type was enforced
- args['mime'] = self._mimetype
+ params['mime'] = self._mimetype
if self._name:
# A name was enforced
- args['name'] = self._name
+ params['name'] = self._name
- return 'file://{path}{args}'.format(
+ return 'file://{path}{params}'.format(
path=self.quote(self.dirty_path),
- args='?{}'.format(self.urlencode(args)) if args else '',
+ params='?{}'.format(self.urlencode(params)) if params else '',
)
def download(self, **kwargs):
diff --git a/libs/apprise/attachment/AttachHTTP.py b/libs/apprise/attachment/AttachHTTP.py
index 046babddb..d5396cf85 100644
--- a/libs/apprise/attachment/AttachHTTP.py
+++ b/libs/apprise/attachment/AttachHTTP.py
@@ -47,10 +47,6 @@ class AttachHTTP(AttachBase):
# The default secure protocol
secure_protocol = 'https'
- # The maximum number of seconds to wait for a connection to be established
- # before out-right just giving up
- connection_timeout_sec = 5.0
-
# The number of bytes in memory to read from the remote source at a time
chunk_size = 8192
@@ -129,7 +125,7 @@ class AttachHTTP(AttachBase):
auth=auth,
params=self.qsd,
verify=self.verify_certificate,
- timeout=self.connection_timeout_sec,
+ timeout=self.request_timeout,
stream=True) as r:
# Handle Errors
@@ -215,7 +211,7 @@ class AttachHTTP(AttachBase):
except requests.RequestException as e:
self.logger.error(
- 'A Connection error occured retrieving HTTP '
+ 'A Connection error occurred retrieving HTTP '
'configuration from %s.' % self.host)
self.logger.debug('Socket Exception: %s' % str(e))
@@ -258,10 +254,8 @@ class AttachHTTP(AttachBase):
Returns the URL built dynamically based on specified arguments.
"""
- # Define any arguments set
- args = {
- 'verify': 'yes' if self.verify_certificate else 'no',
- }
+ # Our URL parameters
+ params = self.url_parameters(privacy=privacy, *args, **kwargs)
# Prepare our cache value
if self.cache is not None:
@@ -271,21 +265,21 @@ class AttachHTTP(AttachBase):
cache = int(self.cache)
# Set our cache value
- args['cache'] = cache
+ params['cache'] = cache
if self._mimetype:
# A format was enforced
- args['mime'] = self._mimetype
+ params['mime'] = self._mimetype
if self._name:
# A name was enforced
- args['name'] = self._name
+ params['name'] = self._name
- # Append our headers into our args
- args.update({'+{}'.format(k): v for k, v in self.headers.items()})
+ # Append our headers into our parameters
+ params.update({'+{}'.format(k): v for k, v in self.headers.items()})
# Apply any remaining entries to our URL
- args.update(self.qsd)
+ params.update(self.qsd)
# Determine Authentication
auth = ''
@@ -302,21 +296,21 @@ class AttachHTTP(AttachBase):
default_port = 443 if self.secure else 80
- return '{schema}://{auth}{hostname}{port}{fullpath}?{args}'.format(
+ return '{schema}://{auth}{hostname}{port}{fullpath}?{params}'.format(
schema=self.secure_protocol if self.secure else self.protocol,
auth=auth,
hostname=self.quote(self.host, safe=''),
port='' if self.port is None or self.port == default_port
else ':{}'.format(self.port),
fullpath=self.quote(self.fullpath, safe='/'),
- args=self.urlencode(args),
+ params=self.urlencode(params),
)
@staticmethod
def parse_url(url):
"""
Parses the URL and returns enough arguments that can allow
- us to substantiate this object.
+ us to re-instantiate this object.
"""
results = AttachBase.parse_url(url)