parent
8dc026d19a
commit
1cdebd0617
@ -1,161 +0,0 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
#
|
|
||||||
# Pushalot Notify Wrapper
|
|
||||||
#
|
|
||||||
# Copyright (C) 2017-2018 Chris Caron <lead2gold@gmail.com>
|
|
||||||
#
|
|
||||||
# This file is part of apprise.
|
|
||||||
#
|
|
||||||
# This program is free software; you can redistribute it and/or modify it
|
|
||||||
# under the terms of the GNU Lesser General Public License as published by
|
|
||||||
# the Free Software Foundation; either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
import re
|
|
||||||
import requests
|
|
||||||
from json import dumps
|
|
||||||
|
|
||||||
from .NotifyBase import NotifyBase
|
|
||||||
from .NotifyBase import HTTP_ERROR_MAP
|
|
||||||
from ..common import NotifyImageSize
|
|
||||||
|
|
||||||
# Extend HTTP Error Messages
|
|
||||||
PUSHALOT_HTTP_ERROR_MAP = HTTP_ERROR_MAP.copy()
|
|
||||||
PUSHALOT_HTTP_ERROR_MAP.update({
|
|
||||||
406: 'Message throttle limit hit.',
|
|
||||||
410: 'AuthorizedToken is no longer valid.',
|
|
||||||
})
|
|
||||||
|
|
||||||
# Used to validate Authorization Token
|
|
||||||
VALIDATE_AUTHTOKEN = re.compile(r'[A-Za-z0-9]{32}')
|
|
||||||
|
|
||||||
|
|
||||||
class NotifyPushalot(NotifyBase):
|
|
||||||
"""
|
|
||||||
A wrapper for Pushalot Notifications
|
|
||||||
"""
|
|
||||||
|
|
||||||
# The default descriptive name associated with the Notification
|
|
||||||
service_name = 'Pushalot'
|
|
||||||
|
|
||||||
# The services URL
|
|
||||||
service_url = 'https://pushalot.com/'
|
|
||||||
|
|
||||||
# The default protocol is always secured
|
|
||||||
secure_protocol = 'palot'
|
|
||||||
|
|
||||||
# A URL that takes you to the setup/help of the specific protocol
|
|
||||||
setup_url = 'https://github.com/caronc/apprise/wiki/Notify_pushalot'
|
|
||||||
|
|
||||||
# Pushalot uses the http protocol with JSON requests
|
|
||||||
notify_url = 'https://pushalot.com/api/sendmessage'
|
|
||||||
|
|
||||||
# Allows the user to specify the NotifyImageSize object
|
|
||||||
image_size = NotifyImageSize.XY_72
|
|
||||||
|
|
||||||
def __init__(self, authtoken, is_important=False, **kwargs):
|
|
||||||
"""
|
|
||||||
Initialize Pushalot Object
|
|
||||||
"""
|
|
||||||
super(NotifyPushalot, self).__init__(**kwargs)
|
|
||||||
|
|
||||||
# Is Important Flag
|
|
||||||
self.is_important = is_important
|
|
||||||
|
|
||||||
self.authtoken = authtoken
|
|
||||||
# Validate authtoken
|
|
||||||
if not VALIDATE_AUTHTOKEN.match(authtoken):
|
|
||||||
self.logger.warning(
|
|
||||||
'Invalid Pushalot Authorization Token Specified.'
|
|
||||||
)
|
|
||||||
raise TypeError(
|
|
||||||
'Invalid Pushalot Authorization Token Specified.'
|
|
||||||
)
|
|
||||||
|
|
||||||
def notify(self, title, body, notify_type, **kwargs):
|
|
||||||
"""
|
|
||||||
Perform Pushalot Notification
|
|
||||||
"""
|
|
||||||
|
|
||||||
headers = {
|
|
||||||
'User-Agent': self.app_id,
|
|
||||||
'Content-Type': 'application/json'
|
|
||||||
}
|
|
||||||
|
|
||||||
# prepare JSON Object
|
|
||||||
payload = {
|
|
||||||
'AuthorizationToken': self.authtoken,
|
|
||||||
'IsImportant': self.is_important,
|
|
||||||
'Title': title,
|
|
||||||
'Body': body,
|
|
||||||
'Source': self.app_id,
|
|
||||||
}
|
|
||||||
|
|
||||||
image_url = self.image_url(notify_type)
|
|
||||||
if image_url:
|
|
||||||
payload['Image'] = image_url
|
|
||||||
|
|
||||||
self.logger.debug('Pushalot POST URL: %s (cert_verify=%r)' % (
|
|
||||||
self.notify_url, self.verify_certificate,
|
|
||||||
))
|
|
||||||
self.logger.debug('Pushalot Payload: %s' % str(payload))
|
|
||||||
try:
|
|
||||||
r = requests.post(
|
|
||||||
self.notify_url,
|
|
||||||
data=dumps(payload),
|
|
||||||
headers=headers,
|
|
||||||
verify=self.verify_certificate,
|
|
||||||
)
|
|
||||||
|
|
||||||
if r.status_code != requests.codes.ok:
|
|
||||||
# We had a problem
|
|
||||||
try:
|
|
||||||
self.logger.warning(
|
|
||||||
'Failed to send Pushalot notification: '
|
|
||||||
'%s (error=%s).' % (
|
|
||||||
PUSHALOT_HTTP_ERROR_MAP[r.status_code],
|
|
||||||
r.status_code))
|
|
||||||
|
|
||||||
except KeyError:
|
|
||||||
self.logger.warning(
|
|
||||||
'Failed to send Pushalot notification '
|
|
||||||
'(error=%s).' % r.status_code)
|
|
||||||
|
|
||||||
# Return; we're done
|
|
||||||
return False
|
|
||||||
|
|
||||||
else:
|
|
||||||
self.logger.info('Sent Pushalot notification.')
|
|
||||||
|
|
||||||
except requests.RequestException as e:
|
|
||||||
self.logger.warning(
|
|
||||||
'A Connection error occured sending Pushalot notification.')
|
|
||||||
self.logger.debug('Socket Exception: %s' % str(e))
|
|
||||||
|
|
||||||
# Return; we're done
|
|
||||||
return False
|
|
||||||
|
|
||||||
return True
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def parse_url(url):
|
|
||||||
"""
|
|
||||||
Parses the URL and returns enough arguments that can allow
|
|
||||||
us to substantiate this object.
|
|
||||||
|
|
||||||
"""
|
|
||||||
results = NotifyBase.parse_url(url)
|
|
||||||
|
|
||||||
if not results:
|
|
||||||
# We're done early as we couldn't load the results
|
|
||||||
return results
|
|
||||||
|
|
||||||
# Apply our settings now
|
|
||||||
results['authtoken'] = results['host']
|
|
||||||
|
|
||||||
return results
|
|
@ -1,246 +0,0 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
#
|
|
||||||
# Stride Notify Wrapper
|
|
||||||
#
|
|
||||||
# Copyright (C) 2018 Chris Caron <lead2gold@gmail.com>
|
|
||||||
#
|
|
||||||
# This file is part of apprise.
|
|
||||||
#
|
|
||||||
# This program is free software; you can redistribute it and/or modify it
|
|
||||||
# under the terms of the GNU Lesser General Public License as published by
|
|
||||||
# the Free Software Foundation; either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
# When you sign-up with stride.com they'll ask if you want to join a channel
|
|
||||||
# or create your own.
|
|
||||||
#
|
|
||||||
# Once you get set up, you'll have the option of creating a channel.
|
|
||||||
#
|
|
||||||
# Now you'll want to connect apprise up. To do this, you need to go to
|
|
||||||
# the App Manager an choose to 'Connect your own app'. It will get you
|
|
||||||
# to provide a 'token name' which can be whatever you want. Call it
|
|
||||||
# 'Apprise' if you want (it really doesn't matter) and then click the
|
|
||||||
# 'Create' button.
|
|
||||||
#
|
|
||||||
# When it completes it will generate a token that looks something like:
|
|
||||||
# HQFtq4pF8rKFOlKTm9Th
|
|
||||||
#
|
|
||||||
# This will become your AUTH_TOKEN
|
|
||||||
#
|
|
||||||
# It will also provide you a conversation URL that might look like:
|
|
||||||
# https://api.atlassian.com/site/ce171c45-79ae-4fec-a73d-5a4b7a322872/\
|
|
||||||
# conversation/a54a80b3-eaad-4564-9a3a-f6653bcfb100/message
|
|
||||||
#
|
|
||||||
# Simplified, it looks like this:
|
|
||||||
# https://api.atlassian.com/site/CLOUD_ID/conversation/CONVO_ID/message
|
|
||||||
#
|
|
||||||
# This plugin will simply work using the url of:
|
|
||||||
# stride://AUTH_TOKEN/CLOUD_ID/CONVO_ID
|
|
||||||
#
|
|
||||||
import requests
|
|
||||||
import re
|
|
||||||
from json import dumps
|
|
||||||
|
|
||||||
from .NotifyBase import NotifyBase
|
|
||||||
from .NotifyBase import HTTP_ERROR_MAP
|
|
||||||
from ..common import NotifyImageSize
|
|
||||||
|
|
||||||
# A Simple UUID4 checker
|
|
||||||
IS_VALID_TOKEN = re.compile(
|
|
||||||
r'([0-9a-f]{8})-*([0-9a-f]{4})-*(4[0-9a-f]{3})-*'
|
|
||||||
r'([89ab][0-9a-f]{3})-*([0-9a-f]{12})', re.I)
|
|
||||||
|
|
||||||
|
|
||||||
class NotifyStride(NotifyBase):
|
|
||||||
"""
|
|
||||||
A wrapper to Stride Notifications
|
|
||||||
|
|
||||||
"""
|
|
||||||
# The default descriptive name associated with the Notification
|
|
||||||
service_name = 'Stride'
|
|
||||||
|
|
||||||
# The services URL
|
|
||||||
service_url = 'https://www.stride.com/'
|
|
||||||
|
|
||||||
# The default secure protocol
|
|
||||||
secure_protocol = 'stride'
|
|
||||||
|
|
||||||
# A URL that takes you to the setup/help of the specific protocol
|
|
||||||
setup_url = 'https://github.com/caronc/apprise/wiki/Notify_stride'
|
|
||||||
|
|
||||||
# Stride Webhook
|
|
||||||
notify_url = 'https://api.atlassian.com/site/{cloud_id}/' \
|
|
||||||
'conversation/{convo_id}/message'
|
|
||||||
|
|
||||||
# Allows the user to specify the NotifyImageSize object
|
|
||||||
image_size = NotifyImageSize.XY_256
|
|
||||||
|
|
||||||
# The maximum allowable characters allowed in the body per message
|
|
||||||
body_maxlen = 2000
|
|
||||||
|
|
||||||
def __init__(self, auth_token, cloud_id, convo_id, **kwargs):
|
|
||||||
"""
|
|
||||||
Initialize Stride Object
|
|
||||||
|
|
||||||
"""
|
|
||||||
super(NotifyStride, self).__init__(**kwargs)
|
|
||||||
|
|
||||||
if not auth_token:
|
|
||||||
raise TypeError(
|
|
||||||
'An invalid Authorization token was specified.'
|
|
||||||
)
|
|
||||||
|
|
||||||
if not cloud_id:
|
|
||||||
raise TypeError('No Cloud ID was specified.')
|
|
||||||
|
|
||||||
cloud_id_re = IS_VALID_TOKEN.match(cloud_id)
|
|
||||||
if cloud_id_re is None:
|
|
||||||
raise TypeError('The specified Cloud ID is not a valid UUID.')
|
|
||||||
|
|
||||||
if not convo_id:
|
|
||||||
raise TypeError('No Conversation ID was specified.')
|
|
||||||
|
|
||||||
convo_id_re = IS_VALID_TOKEN.match(convo_id)
|
|
||||||
if convo_id_re is None:
|
|
||||||
raise TypeError(
|
|
||||||
'The specified Conversation ID is not a valid UUID.')
|
|
||||||
|
|
||||||
# Store our validated token
|
|
||||||
self.cloud_id = '{0}-{1}-{2}-{3}-{4}'.format(
|
|
||||||
cloud_id_re.group(0),
|
|
||||||
cloud_id_re.group(1),
|
|
||||||
cloud_id_re.group(2),
|
|
||||||
cloud_id_re.group(3),
|
|
||||||
cloud_id_re.group(4),
|
|
||||||
)
|
|
||||||
|
|
||||||
# Store our validated token
|
|
||||||
self.convo_id = '{0}-{1}-{2}-{3}-{4}'.format(
|
|
||||||
convo_id_re.group(0),
|
|
||||||
convo_id_re.group(1),
|
|
||||||
convo_id_re.group(2),
|
|
||||||
convo_id_re.group(3),
|
|
||||||
convo_id_re.group(4),
|
|
||||||
)
|
|
||||||
|
|
||||||
self.auth_token = auth_token
|
|
||||||
|
|
||||||
return
|
|
||||||
|
|
||||||
def notify(self, title, body, notify_type, **kwargs):
|
|
||||||
"""
|
|
||||||
Perform Stride Notification
|
|
||||||
"""
|
|
||||||
|
|
||||||
headers = {
|
|
||||||
'User-Agent': self.app_id,
|
|
||||||
'Authorization': 'Bearer {auth_token}'.format(
|
|
||||||
auth_token=self.auth_token),
|
|
||||||
'Content-Type': 'application/json',
|
|
||||||
}
|
|
||||||
|
|
||||||
# Prepare JSON Object
|
|
||||||
payload = {
|
|
||||||
"body": {
|
|
||||||
"version": 1,
|
|
||||||
"type": "doc",
|
|
||||||
"content": [{
|
|
||||||
"type": "paragraph",
|
|
||||||
"content": [{
|
|
||||||
"type": "text",
|
|
||||||
"text": body,
|
|
||||||
}],
|
|
||||||
}],
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# Construct Notify URL
|
|
||||||
notify_url = self.notify_url.format(
|
|
||||||
cloud_id=self.cloud_id,
|
|
||||||
convo_id=self.convo_id,
|
|
||||||
)
|
|
||||||
|
|
||||||
self.logger.debug('Stride POST URL: %s (cert_verify=%r)' % (
|
|
||||||
notify_url, self.verify_certificate,
|
|
||||||
))
|
|
||||||
self.logger.debug('Stride Payload: %s' % str(payload))
|
|
||||||
try:
|
|
||||||
r = requests.post(
|
|
||||||
notify_url,
|
|
||||||
data=dumps(payload),
|
|
||||||
headers=headers,
|
|
||||||
verify=self.verify_certificate,
|
|
||||||
)
|
|
||||||
if r.status_code not in (
|
|
||||||
requests.codes.ok, requests.codes.no_content):
|
|
||||||
# We had a problem
|
|
||||||
try:
|
|
||||||
self.logger.warning(
|
|
||||||
'Failed to send Stride notification: '
|
|
||||||
'%s (error=%s).' % (
|
|
||||||
HTTP_ERROR_MAP[r.status_code],
|
|
||||||
r.status_code))
|
|
||||||
|
|
||||||
except KeyError:
|
|
||||||
self.logger.warning(
|
|
||||||
'Failed to send Stride notification '
|
|
||||||
'(error=%s).' % r.status_code)
|
|
||||||
|
|
||||||
self.logger.debug('Response Details: %s' % r.raw.read())
|
|
||||||
|
|
||||||
# Return; we're done
|
|
||||||
return False
|
|
||||||
|
|
||||||
else:
|
|
||||||
self.logger.info('Sent Stride notification.')
|
|
||||||
|
|
||||||
except requests.RequestException as e:
|
|
||||||
self.logger.warning(
|
|
||||||
'A Connection error occured sending Stride '
|
|
||||||
'notification.'
|
|
||||||
)
|
|
||||||
self.logger.debug('Socket Exception: %s' % str(e))
|
|
||||||
return False
|
|
||||||
|
|
||||||
return True
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def parse_url(url):
|
|
||||||
"""
|
|
||||||
Parses the URL and returns enough arguments that can allow
|
|
||||||
us to substantiate this object.
|
|
||||||
|
|
||||||
Syntax:
|
|
||||||
stride://auth_token/cloud_id/convo_id
|
|
||||||
|
|
||||||
"""
|
|
||||||
results = NotifyBase.parse_url(url)
|
|
||||||
|
|
||||||
if not results:
|
|
||||||
# We're done early as we couldn't load the results
|
|
||||||
return results
|
|
||||||
|
|
||||||
# Store our Authentication Token
|
|
||||||
auth_token = results['host']
|
|
||||||
|
|
||||||
# Now fetch our tokens
|
|
||||||
try:
|
|
||||||
(ta, tb) = [x for x in filter(bool, NotifyBase.split_path(
|
|
||||||
results['fullpath']))][0:2]
|
|
||||||
|
|
||||||
except (ValueError, AttributeError, IndexError):
|
|
||||||
# Force some bad values that will get caught
|
|
||||||
# in parsing later
|
|
||||||
ta = None
|
|
||||||
tb = None
|
|
||||||
|
|
||||||
results['cloud_id'] = ta
|
|
||||||
results['convo_id'] = tb
|
|
||||||
results['auth_token'] = auth_token
|
|
||||||
|
|
||||||
return results
|
|
@ -1,180 +0,0 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
#
|
|
||||||
# (Super) Toasty Notify Wrapper
|
|
||||||
#
|
|
||||||
# Copyright (C) 2017-2018 Chris Caron <lead2gold@gmail.com>
|
|
||||||
#
|
|
||||||
# This file is part of apprise.
|
|
||||||
#
|
|
||||||
# This program is free software; you can redistribute it and/or modify it
|
|
||||||
# under the terms of the GNU Lesser General Public License as published by
|
|
||||||
# the Free Software Foundation; either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU Lesser General Public License for more details.
|
|
||||||
|
|
||||||
import re
|
|
||||||
import requests
|
|
||||||
|
|
||||||
from .NotifyBase import NotifyBase
|
|
||||||
from .NotifyBase import HTTP_ERROR_MAP
|
|
||||||
from ..common import NotifyImageSize
|
|
||||||
from ..utils import compat_is_basestring
|
|
||||||
|
|
||||||
# Used to break apart list of potential devices by their delimiter
|
|
||||||
# into a usable list.
|
|
||||||
DEVICES_LIST_DELIM = re.compile(r'[ \t\r\n,\\/]+')
|
|
||||||
|
|
||||||
|
|
||||||
class NotifyToasty(NotifyBase):
|
|
||||||
"""
|
|
||||||
A wrapper for Toasty Notifications
|
|
||||||
"""
|
|
||||||
|
|
||||||
# The default descriptive name associated with the Notification
|
|
||||||
service_name = 'Toasty'
|
|
||||||
|
|
||||||
# The services URL
|
|
||||||
service_url = 'http://supertoasty.com/'
|
|
||||||
|
|
||||||
# The default protocol
|
|
||||||
protocol = 'toasty'
|
|
||||||
|
|
||||||
# A URL that takes you to the setup/help of the specific protocol
|
|
||||||
setup_url = 'https://github.com/caronc/apprise/wiki/Notify_toasty'
|
|
||||||
|
|
||||||
# Toasty uses the http protocol with JSON requests
|
|
||||||
notify_url = 'http://api.supertoasty.com/notify/'
|
|
||||||
|
|
||||||
# Allows the user to specify the NotifyImageSize object
|
|
||||||
image_size = NotifyImageSize.XY_128
|
|
||||||
|
|
||||||
def __init__(self, devices, **kwargs):
|
|
||||||
"""
|
|
||||||
Initialize Toasty Object
|
|
||||||
"""
|
|
||||||
super(NotifyToasty, self).__init__(**kwargs)
|
|
||||||
|
|
||||||
if compat_is_basestring(devices):
|
|
||||||
self.devices = [x for x in filter(bool, DEVICES_LIST_DELIM.split(
|
|
||||||
devices,
|
|
||||||
))]
|
|
||||||
|
|
||||||
elif isinstance(devices, (set, tuple, list)):
|
|
||||||
self.devices = devices
|
|
||||||
|
|
||||||
else:
|
|
||||||
self.devices = list()
|
|
||||||
|
|
||||||
if len(devices) == 0:
|
|
||||||
raise TypeError('You must specify at least 1 device.')
|
|
||||||
|
|
||||||
if not self.user:
|
|
||||||
raise TypeError('You must specify a username.')
|
|
||||||
|
|
||||||
def notify(self, title, body, notify_type, **kwargs):
|
|
||||||
"""
|
|
||||||
Perform Toasty Notification
|
|
||||||
"""
|
|
||||||
|
|
||||||
headers = {
|
|
||||||
'User-Agent': self.app_id,
|
|
||||||
'Content-Type': 'multipart/form-data',
|
|
||||||
}
|
|
||||||
|
|
||||||
# error tracking (used for function return)
|
|
||||||
has_error = False
|
|
||||||
|
|
||||||
# Create a copy of the devices list
|
|
||||||
devices = list(self.devices)
|
|
||||||
while len(devices):
|
|
||||||
device = devices.pop(0)
|
|
||||||
|
|
||||||
# prepare JSON Object
|
|
||||||
payload = {
|
|
||||||
'sender': NotifyBase.quote(self.user),
|
|
||||||
'title': NotifyBase.quote(title),
|
|
||||||
'text': NotifyBase.quote(body),
|
|
||||||
}
|
|
||||||
|
|
||||||
image_url = self.image_url(notify_type)
|
|
||||||
if image_url:
|
|
||||||
payload['image'] = image_url
|
|
||||||
|
|
||||||
# URL to transmit content via
|
|
||||||
url = '%s%s' % (self.notify_url, device)
|
|
||||||
|
|
||||||
self.logger.debug('Toasty POST URL: %s (cert_verify=%r)' % (
|
|
||||||
url, self.verify_certificate,
|
|
||||||
))
|
|
||||||
self.logger.debug('Toasty Payload: %s' % str(payload))
|
|
||||||
try:
|
|
||||||
r = requests.get(
|
|
||||||
url,
|
|
||||||
data=payload,
|
|
||||||
headers=headers,
|
|
||||||
verify=self.verify_certificate,
|
|
||||||
)
|
|
||||||
if r.status_code != requests.codes.ok:
|
|
||||||
# We had a problem
|
|
||||||
try:
|
|
||||||
self.logger.warning(
|
|
||||||
'Failed to send Toasty:%s '
|
|
||||||
'notification: %s (error=%s).' % (
|
|
||||||
device,
|
|
||||||
HTTP_ERROR_MAP[r.status_code],
|
|
||||||
r.status_code))
|
|
||||||
|
|
||||||
except KeyError:
|
|
||||||
self.logger.warning(
|
|
||||||
'Failed to send Toasty:%s '
|
|
||||||
'notification (error=%s).' % (
|
|
||||||
device,
|
|
||||||
r.status_code))
|
|
||||||
|
|
||||||
# self.logger.debug('Response Details: %s' % r.raw.read())
|
|
||||||
|
|
||||||
# Return; we're done
|
|
||||||
has_error = True
|
|
||||||
|
|
||||||
else:
|
|
||||||
self.logger.info(
|
|
||||||
'Sent Toasty notification to %s.' % device)
|
|
||||||
|
|
||||||
except requests.RequestException as e:
|
|
||||||
self.logger.warning(
|
|
||||||
'A Connection error occured sending Toasty:%s ' % (
|
|
||||||
device) + 'notification.'
|
|
||||||
)
|
|
||||||
self.logger.debug('Socket Exception: %s' % str(e))
|
|
||||||
has_error = True
|
|
||||||
|
|
||||||
if len(devices):
|
|
||||||
# Prevent thrashing requests
|
|
||||||
self.throttle()
|
|
||||||
|
|
||||||
return not has_error
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def parse_url(url):
|
|
||||||
"""
|
|
||||||
Parses the URL and returns enough arguments that can allow
|
|
||||||
us to substantiate this object.
|
|
||||||
|
|
||||||
"""
|
|
||||||
results = NotifyBase.parse_url(url)
|
|
||||||
|
|
||||||
if not results:
|
|
||||||
# We're done early as we couldn't load the results
|
|
||||||
return results
|
|
||||||
|
|
||||||
# Apply our settings now
|
|
||||||
devices = NotifyBase.unquote(results['fullpath'])
|
|
||||||
|
|
||||||
# Store our devices
|
|
||||||
results['devices'] = '%s/%s' % (results['host'], devices)
|
|
||||||
|
|
||||||
return results
|
|
Loading…
Reference in new issue