Skip to content

Commit

Permalink
updated to apprise v0.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
caronc committed Sep 9, 2018
1 parent bb8f1b2 commit 7c9e1a1
Show file tree
Hide file tree
Showing 29 changed files with 183 additions and 134 deletions.
5 changes: 3 additions & 2 deletions Notify/apprise/Apprise.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
SCHEMA_MAP = {}

# Used for attempting to acquire the schema if the URL can't be parsed.
GET_SCHEMA_RE = re.compile('\s*(?P<schema>[a-z0-9]{3,9})://.*$', re.I)
GET_SCHEMA_RE = re.compile(r'\s*(?P<schema>[a-z0-9]{3,9})://.*$', re.I)


# Load our Lookup Matrix
Expand Down Expand Up @@ -205,7 +205,8 @@ def add(self, servers, asset=None):
if not instance:
return_status = False
logging.error(
"Failed to load notification url: {}".format(_server))
"Failed to load notification url: {}".format(_server),
)
continue

# Add our initialized plugin to our server listings
Expand Down
2 changes: 1 addition & 1 deletion Notify/apprise/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# GNU Lesser General Public License for more details.

__title__ = 'apprise'
__version__ = '0.0.9'
__version__ = '0.5.0'
__author__ = 'Chris Caron <lead2gold@gmail.com>'
__license__ = 'GPLv3'
__copywrite__ = 'Copyright 2017-2018 Chris Caron <lead2gold@gmail.com>'
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
3 changes: 2 additions & 1 deletion Notify/apprise/plugins/NotifyBase.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ def _escape(text):
# Regular expression retrieved from:
# http://www.regular-expressions.info/email.html
IS_EMAIL_RE = re.compile(
r"(?P<userid>[a-z0-9$%+=_~-]+"
r"((?P<label>[^+]+)\+)?"
r"(?P<userid>[a-z0-9$%=_~-]+"
r"(?:\.[a-z0-9$%+=_~-]+)"
r"*)@(?P<domain>(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+"
r"[a-z0-9](?:[a-z0-9-]*"
Expand Down
23 changes: 13 additions & 10 deletions Notify/apprise/plugins/NotifyEmail.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class WebBaseLogin(object):
# Google GMail
(
'Google Mail',
re.compile(r'^(?P<id>[^@]+)@(?P<domain>gmail\.com)$', re.I),
re.compile(r'^((?P<label>[^+]+)\+)?(?P<id>[^@]+)@(?P<domain>gmail\.com)$', re.I),
{
'port': 587,
'smtp_host': 'smtp.gmail.com',
Expand All @@ -59,7 +59,7 @@ class WebBaseLogin(object):
# Pronto Mail
(
'Pronto Mail',
re.compile(r'^(?P<id>[^@]+)@(?P<domain>prontomail\.com)$', re.I),
re.compile(r'^((?P<label>[^+]+)\+)?(?P<id>[^@]+)@(?P<domain>prontomail\.com)$', re.I),
{
'port': 465,
'smtp_host': 'secure.emailsrvr.com',
Expand All @@ -71,7 +71,7 @@ class WebBaseLogin(object):
# Microsoft Hotmail
(
'Microsoft Hotmail',
re.compile(r'^(?P<id>[^@]+)@(?P<domain>(hotmail|live)\.com)$', re.I),
re.compile(r'^((?P<label>[^+]+)\+)?(?P<id>[^@]+)@(?P<domain>(hotmail|live)\.com)$', re.I),
{
'port': 587,
'smtp_host': 'smtp.live.com',
Expand All @@ -83,7 +83,7 @@ class WebBaseLogin(object):
# Yahoo Mail
(
'Yahoo Mail',
re.compile(r'^(?P<id>[^@]+)@(?P<domain>yahoo\.(ca|com))$', re.I),
re.compile(r'^((?P<label>[^+]+)\+)?(?P<id>[^@]+)@(?P<domain>yahoo\.(ca|com))$', re.I),
{
'port': 465,
'smtp_host': 'smtp.mail.yahoo.com',
Expand All @@ -95,7 +95,7 @@ class WebBaseLogin(object):
# Catch All
(
'Custom',
re.compile(r'^(?P<id>[^@]+)@(?P<domain>.+)$', re.I),
re.compile(r'^((?P<label>[^+]+)\+)?(?P<id>[^@]+)@(?P<domain>.+)$', re.I),
{
# Setting smtp_host to None is a way of
# auto-detecting it based on other parameters
Expand Down Expand Up @@ -202,7 +202,7 @@ def NotifyEmailDefaults(self):

if self.smtp_host is None:
# Detect Server if possible
self.smtp_host = re.split('[\s@]+', self.from_addr)[-1]
self.smtp_host = re.split(r'[\s@]+', self.from_addr)[-1]

# Adjust email login based on the defined
# usertype
Expand Down Expand Up @@ -253,6 +253,8 @@ def notify(self, title, body, **kwargs):
.strftime("%a, %d %b %Y %H:%M:%S +0000")
email['X-Application'] = self.app_id

# bind the socket variable to the current namespace
socket = None
try:
self.logger.debug('Connecting to remote SMTP server...')
socket = smtplib.SMTP(
Expand Down Expand Up @@ -289,7 +291,8 @@ def notify(self, title, body, **kwargs):

finally:
# Gracefully terminate the connection with the server
socket.quit()
if socket is not None: # pragma: no branch
socket.quit()

return True

Expand Down Expand Up @@ -329,14 +332,14 @@ def parse_url(url):
# get 'To' email address
from_addr = '%s@%s' % (
re.split(
'[\s@]+', NotifyBase.unquote(results['user']))[0],
r'[\s@]+', NotifyBase.unquote(results['user']))[0],
results.get('host', '')
)
# Lets be clever and attempt to make the from
# address an email based on the to address
from_addr = '%s@%s' % (
re.split('[\s@]+', from_addr)[0],
re.split('[\s@]+', from_addr)[-1],
re.split(r'[\s@]+', from_addr)[0],
re.split(r'[\s@]+', from_addr)[-1],
)

# Attempt to detect 'to' email address
Expand Down
10 changes: 5 additions & 5 deletions Notify/apprise/plugins/NotifyGrowl/gntp/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,18 @@

#GNTP/<version> <messagetype> <encryptionAlgorithmID>[:<ivValue>][ <keyHashAlgorithmID>:<keyHash>.<salt>]
GNTP_INFO_LINE = re.compile(
'GNTP/(?P<version>\d+\.\d+) (?P<messagetype>REGISTER|NOTIFY|SUBSCRIBE|\-OK|\-ERROR)' +
' (?P<encryptionAlgorithmID>[A-Z0-9]+(:(?P<ivValue>[A-F0-9]+))?) ?' +
'((?P<keyHashAlgorithmID>[A-Z0-9]+):(?P<keyHash>[A-F0-9]+).(?P<salt>[A-F0-9]+))?\r\n',
r'GNTP/(?P<version>\d+\.\d+) (?P<messagetype>REGISTER|NOTIFY|SUBSCRIBE|\-OK|\-ERROR)' +
r' (?P<encryptionAlgorithmID>[A-Z0-9]+(:(?P<ivValue>[A-F0-9]+))?) ?' +
r'((?P<keyHashAlgorithmID>[A-Z0-9]+):(?P<keyHash>[A-F0-9]+).(?P<salt>[A-F0-9]+))?\r\n',
re.IGNORECASE
)

GNTP_INFO_LINE_SHORT = re.compile(
'GNTP/(?P<version>\d+\.\d+) (?P<messagetype>REGISTER|NOTIFY|SUBSCRIBE|\-OK|\-ERROR)',
r'GNTP/(?P<version>\d+\.\d+) (?P<messagetype>REGISTER|NOTIFY|SUBSCRIBE|\-OK|\-ERROR)',
re.IGNORECASE
)

GNTP_HEADER = re.compile('([\w-]+):(.+)')
GNTP_HEADER = re.compile(r'([\w-]+):(.+)')

GNTP_EOL = shim.b('\r\n')
GNTP_SEP = shim.b(': ')
Expand Down
1 change: 0 additions & 1 deletion Notify/apprise/plugins/NotifyPushjet/pushjet/errors.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# -*- coding: utf-8 -*-

from __future__ import unicode_literals

from requests import RequestException

Expand Down
6 changes: 2 additions & 4 deletions Notify/apprise/plugins/NotifyPushjet/pushjet/pushjet.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-

from __future__ import unicode_literals

import requests
from functools import partial

Expand Down Expand Up @@ -221,7 +219,7 @@ def unsubscribe(self, service):
def get_subscriptions(self):
"""Get all the subscriptions the device has.
:return: A list of :class:`~pushjet.Subscription`\ s.
:return: A list of :class:`~pushjet.Subscription`.
"""
_, response = self._request('subscription', 'GET')
subscriptions = []
Expand All @@ -232,7 +230,7 @@ def get_subscriptions(self):
def get_messages(self):
"""Get all new (that is, as of yet unretrieved) messages.
:return: A list of :class:`~pushjet.Message`\ s.
:return: A list of :class:`~pushjet.Message`.
"""
_, response = self._request('message', 'GET')
messages = []
Expand Down
2 changes: 0 additions & 2 deletions Notify/apprise/plugins/NotifyPushjet/pushjet/utilities.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-

from __future__ import unicode_literals

import re
import sys
from decorator import decorator
Expand Down
2 changes: 1 addition & 1 deletion Notify/apprise/plugins/NotifyRocketChat.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def notify(self, title, body, notify_type, **kwargs):
return False

# Prepare our message
text = '*%s*\r\n%s' % (title.replace('*', '\*'), body)
text = '*%s*\r\n%s' % (title.replace('*', '\\*'), body)

# Initiaize our error tracking
has_error = False
Expand Down
8 changes: 4 additions & 4 deletions Notify/apprise/plugins/NotifySlack.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,11 @@ def __init__(self, token_a, token_b, token_c, channels, **kwargs):
# https://api.slack.com/docs/message-formatting
self._re_formatting_map = {
# New lines must become the string version
'\r\*\n': '\\n',
r'\r\*\n': '\\n',
# Escape other special characters
'&': '&amp;',
'<': '&lt;',
'>': '&gt;',
r'&': '&amp;',
r'<': '&lt;',
r'>': '&gt;',
}

# Iterate over above list and store content accordingly
Expand Down
2 changes: 1 addition & 1 deletion Notify/apprise/plugins/NotifyTelegram.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ def detect_bot_owner(self):
# Load our response and attempt to fetch our userid
response = loads(r.content)
if 'ok' in response and response['ok'] is True:
start = re.compile('^\s*\/start', re.I)
start = re.compile(r'^\s*\/start', re.I)
for _msg in iter(response['result']):
# Find /start
if not start.search(_msg['message']['text']):
Expand Down
2 changes: 1 addition & 1 deletion Notify/apprise/plugins/NotifyTwitter/tweepy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"""
Tweepy Twitter API library
"""
__version__ = '3.5.0'
__version__ = '3.6.0'
__author__ = 'Joshua Roesslein'
__license__ = 'MIT'

Expand Down
Loading

0 comments on commit 7c9e1a1

Please sign in to comment.