mirror of https://github.com/caronc/apprise
deprication warning cleanup
parent
419bcdb0b3
commit
804e27c5fd
|
@ -39,7 +39,7 @@ logger = logging.getLogger(__name__)
|
||||||
SCHEMA_MAP = {}
|
SCHEMA_MAP = {}
|
||||||
|
|
||||||
# Used for attempting to acquire the schema if the URL can't be parsed.
|
# 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
|
# Load our Lookup Matrix
|
||||||
|
|
|
@ -202,7 +202,7 @@ class NotifyEmail(NotifyBase):
|
||||||
|
|
||||||
if self.smtp_host is None:
|
if self.smtp_host is None:
|
||||||
# Detect Server if possible
|
# 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
|
# Adjust email login based on the defined
|
||||||
# usertype
|
# usertype
|
||||||
|
@ -332,14 +332,14 @@ class NotifyEmail(NotifyBase):
|
||||||
# get 'To' email address
|
# get 'To' email address
|
||||||
from_addr = '%s@%s' % (
|
from_addr = '%s@%s' % (
|
||||||
re.split(
|
re.split(
|
||||||
'[\s@]+', NotifyBase.unquote(results['user']))[0],
|
r'[\s@]+', NotifyBase.unquote(results['user']))[0],
|
||||||
results.get('host', '')
|
results.get('host', '')
|
||||||
)
|
)
|
||||||
# Lets be clever and attempt to make the from
|
# Lets be clever and attempt to make the from
|
||||||
# address an email based on the to address
|
# address an email based on the to address
|
||||||
from_addr = '%s@%s' % (
|
from_addr = '%s@%s' % (
|
||||||
re.split('[\s@]+', from_addr)[0],
|
re.split(r'[\s@]+', from_addr)[0],
|
||||||
re.split('[\s@]+', from_addr)[-1],
|
re.split(r'[\s@]+', from_addr)[-1],
|
||||||
)
|
)
|
||||||
|
|
||||||
# Attempt to detect 'to' email address
|
# Attempt to detect 'to' email address
|
||||||
|
|
|
@ -19,18 +19,18 @@ __all__ = [
|
||||||
|
|
||||||
#GNTP/<version> <messagetype> <encryptionAlgorithmID>[:<ivValue>][ <keyHashAlgorithmID>:<keyHash>.<salt>]
|
#GNTP/<version> <messagetype> <encryptionAlgorithmID>[:<ivValue>][ <keyHashAlgorithmID>:<keyHash>.<salt>]
|
||||||
GNTP_INFO_LINE = re.compile(
|
GNTP_INFO_LINE = 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)' +
|
||||||
' (?P<encryptionAlgorithmID>[A-Z0-9]+(:(?P<ivValue>[A-F0-9]+))?) ?' +
|
r' (?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'((?P<keyHashAlgorithmID>[A-Z0-9]+):(?P<keyHash>[A-F0-9]+).(?P<salt>[A-F0-9]+))?\r\n',
|
||||||
re.IGNORECASE
|
re.IGNORECASE
|
||||||
)
|
)
|
||||||
|
|
||||||
GNTP_INFO_LINE_SHORT = re.compile(
|
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
|
re.IGNORECASE
|
||||||
)
|
)
|
||||||
|
|
||||||
GNTP_HEADER = re.compile('([\w-]+):(.+)')
|
GNTP_HEADER = re.compile(r'([\w-]+):(.+)')
|
||||||
|
|
||||||
GNTP_EOL = shim.b('\r\n')
|
GNTP_EOL = shim.b('\r\n')
|
||||||
GNTP_SEP = shim.b(': ')
|
GNTP_SEP = shim.b(': ')
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
from requests import RequestException
|
from requests import RequestException
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
from functools import partial
|
from functools import partial
|
||||||
|
|
||||||
|
@ -221,7 +219,7 @@ class Device(PushjetModel):
|
||||||
def get_subscriptions(self):
|
def get_subscriptions(self):
|
||||||
"""Get all the subscriptions the device has.
|
"""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')
|
_, response = self._request('subscription', 'GET')
|
||||||
subscriptions = []
|
subscriptions = []
|
||||||
|
@ -232,7 +230,7 @@ class Device(PushjetModel):
|
||||||
def get_messages(self):
|
def get_messages(self):
|
||||||
"""Get all new (that is, as of yet unretrieved) messages.
|
"""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')
|
_, response = self._request('message', 'GET')
|
||||||
messages = []
|
messages = []
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
from decorator import decorator
|
from decorator import decorator
|
||||||
|
|
|
@ -128,7 +128,7 @@ class NotifyRocketChat(NotifyBase):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# Prepare our message
|
# Prepare our message
|
||||||
text = '*%s*\r\n%s' % (title.replace('*', '\*'), body)
|
text = '*%s*\r\n%s' % (title.replace('*', '\\*'), body)
|
||||||
|
|
||||||
# Initiaize our error tracking
|
# Initiaize our error tracking
|
||||||
has_error = False
|
has_error = False
|
||||||
|
|
|
@ -146,11 +146,11 @@ class NotifySlack(NotifyBase):
|
||||||
# https://api.slack.com/docs/message-formatting
|
# https://api.slack.com/docs/message-formatting
|
||||||
self._re_formatting_map = {
|
self._re_formatting_map = {
|
||||||
# New lines must become the string version
|
# New lines must become the string version
|
||||||
'\r\*\n': '\\n',
|
r'\r\*\n': '\\n',
|
||||||
# Escape other special characters
|
# Escape other special characters
|
||||||
'&': '&',
|
r'&': '&',
|
||||||
'<': '<',
|
r'<': '<',
|
||||||
'>': '>',
|
r'>': '>',
|
||||||
}
|
}
|
||||||
|
|
||||||
# Iterate over above list and store content accordingly
|
# Iterate over above list and store content accordingly
|
||||||
|
|
|
@ -302,7 +302,7 @@ class NotifyTelegram(NotifyBase):
|
||||||
# Load our response and attempt to fetch our userid
|
# Load our response and attempt to fetch our userid
|
||||||
response = loads(r.content)
|
response = loads(r.content)
|
||||||
if 'ok' in response and response['ok'] is True:
|
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']):
|
for _msg in iter(response['result']):
|
||||||
# Find /start
|
# Find /start
|
||||||
if not start.search(_msg['message']['text']):
|
if not start.search(_msg['message']['text']):
|
||||||
|
|
|
@ -19,7 +19,7 @@ import six
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|
||||||
re_path_template = re.compile('{\w+}')
|
re_path_template = re.compile(r'{\w+}')
|
||||||
|
|
||||||
log = logging.getLogger('tweepy.binder')
|
log = logging.getLogger('tweepy.binder')
|
||||||
|
|
||||||
|
|
|
@ -306,7 +306,7 @@ class Stream(object):
|
||||||
|
|
||||||
def _read_loop(self, resp):
|
def _read_loop(self, resp):
|
||||||
charset = resp.headers.get('content-type', default='')
|
charset = resp.headers.get('content-type', default='')
|
||||||
enc_search = re.search('charset=(?P<enc>\S*)', charset)
|
enc_search = re.search(r'charset=(?P<enc>\S*)', charset)
|
||||||
if enc_search is not None:
|
if enc_search is not None:
|
||||||
encoding = enc_search.group('enc')
|
encoding = enc_search.group('enc')
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -95,7 +95,7 @@ def is_hostname(hostname):
|
||||||
if hostname[-1] == ".":
|
if hostname[-1] == ".":
|
||||||
hostname = hostname[:-1]
|
hostname = hostname[:-1]
|
||||||
|
|
||||||
allowed = re.compile("(?!-)[A-Z\d_-]{1,63}(?<!-)$", re.IGNORECASE)
|
allowed = re.compile(r'(?!-)[A-Z\d_-]{1,63}(?<!-)$', re.IGNORECASE)
|
||||||
return all(allowed.match(x) for x in hostname.split("."))
|
return all(allowed.match(x) for x in hostname.split("."))
|
||||||
|
|
||||||
|
|
||||||
|
@ -256,7 +256,7 @@ def parse_url(url, default_schema='http', verify_host=True):
|
||||||
result['query'] = None
|
result['query'] = None
|
||||||
try:
|
try:
|
||||||
(result['user'], result['host']) = \
|
(result['user'], result['host']) = \
|
||||||
re.split('[\s@]+', result['host'])[:2]
|
re.split(r'[\s@]+', result['host'])[:2]
|
||||||
|
|
||||||
except ValueError:
|
except ValueError:
|
||||||
# no problem then, host only exists
|
# no problem then, host only exists
|
||||||
|
@ -266,7 +266,7 @@ def parse_url(url, default_schema='http', verify_host=True):
|
||||||
if result['user'] is not None:
|
if result['user'] is not None:
|
||||||
try:
|
try:
|
||||||
(result['user'], result['password']) = \
|
(result['user'], result['password']) = \
|
||||||
re.split('[:\s]+', result['user'])[:2]
|
re.split(r'[:\s]+', result['user'])[:2]
|
||||||
|
|
||||||
except ValueError:
|
except ValueError:
|
||||||
# no problem then, user only exists
|
# no problem then, user only exists
|
||||||
|
@ -275,7 +275,7 @@ def parse_url(url, default_schema='http', verify_host=True):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
(result['host'], result['port']) = \
|
(result['host'], result['port']) = \
|
||||||
re.split('[\s:]+', result['host'])[:2]
|
re.split(r'[\s:]+', result['host'])[:2]
|
||||||
|
|
||||||
except ValueError:
|
except ValueError:
|
||||||
# no problem then, user only exists
|
# no problem then, user only exists
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
# GNU Lesser General Public License for more details.
|
# GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
from __future__ import unicode_literals
|
|
||||||
from os import chmod
|
from os import chmod
|
||||||
from os import getuid
|
from os import getuid
|
||||||
from os.path import dirname
|
from os.path import dirname
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
# GNU Lesser General Public License for more details.
|
# GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
from __future__ import unicode_literals
|
|
||||||
from apprise import cli
|
from apprise import cli
|
||||||
from apprise import NotifyBase
|
from apprise import NotifyBase
|
||||||
from click.testing import CliRunner
|
from click.testing import CliRunner
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
# GNU Lesser General Public License for more details.
|
# GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
from __future__ import unicode_literals
|
|
||||||
try:
|
try:
|
||||||
# Python 2.7
|
# Python 2.7
|
||||||
from urllib import unquote
|
from urllib import unquote
|
||||||
|
|
Loading…
Reference in New Issue