Exemplo n.º 1
0
from NotifyBase import NotifyFormat
from NotifyBase import HTTP_ERROR_MAP
from NotifyBase import IS_EMAIL_RE

# Flag used as a placeholder to sending to all devices
PUSHBULLET_SEND_TO_ALL = 'ALL_DEVICES'

# PushBullet uses the http protocol with JSON requests
PUSHBULLET_URL = 'https://api.pushbullet.com/v2/pushes'

# Used to break apart list of potential recipients by their delimiter
# into a usable list.
RECIPIENTS_LIST_DELIM = re.compile(r'[ \t\r\n,\\/]+')

# Extend HTTP Error Messages
PUSHBULLET_HTTP_ERROR_MAP = dict(HTTP_ERROR_MAP.items() + {
    401: 'Unauthorized - Invalid Token.',
}.items())


class NotifyPushBullet(NotifyBase):
    """
    A wrapper for PushBullet Notifications
    """
    def __init__(self, accesstoken, recipients=None, **kwargs):
        """
        Initialize PushBullet Object
        """
        super(NotifyPushBullet, self).__init__(title_maxlen=250,
                                               body_maxlen=32768,
                                               notify_format=NotifyFormat.TEXT,
Exemplo n.º 2
0
    EMERGENCY = 2


PUSHOVER_PRIORITIES = (
    PushoverPriority.VERY_LOW,
    PushoverPriority.MODERATE,
    PushoverPriority.NORMAL,
    PushoverPriority.HIGH,
    PushoverPriority.EMERGENCY,
)

# Used to break path apart into list of devices
DEVICE_LIST_DELIM = re.compile(r'[ \t\r\n,\\/]+')

# Extend HTTP Error Messages
PUSHOVER_HTTP_ERROR_MAP = dict(HTTP_ERROR_MAP.items() + {
    401: 'Unauthorized - Invalid Token.',
}.items())


class NotifyPushover(NotifyBase):
    """
    A wrapper for Pushover Notifications
    """
    def __init__(self,
                 token,
                 devices=None,
                 priority=PushoverPriority.NORMAL,
                 **kwargs):
        """
        Initialize Pushover Object
Exemplo n.º 3
0
    VERY_LOW = -2
    MODERATE = -1
    NORMAL = 0
    HIGH = 1
    EMERGENCY = 2

PROWL_PRIORITIES = (
    ProwlPriority.VERY_LOW,
    ProwlPriority.MODERATE,
    ProwlPriority.NORMAL,
    ProwlPriority.HIGH,
    ProwlPriority.EMERGENCY,
)

# Extend HTTP Error Messages
PROWL_HTTP_ERROR_MAP = dict(HTTP_ERROR_MAP.items() + {
    406: 'IP address has exceeded API limit',
    409: 'Request not aproved.',
}.items())

class NotifyProwl(NotifyBase):
    """
    A wrapper for Prowl Notifications
    """
    def __init__(self, apikey, providerkey=None,
                 priority=ProwlPriority.NORMAL,
                 **kwargs):
        """
        Initialize Prowl Object
        """
        super(NotifyProwl, self).__init__(
Exemplo n.º 4
0
from NotifyBase import NotifyBase
from NotifyBase import NotifyFormat
from NotifyBase import HTTP_ERROR_MAP
from NotifyBase import NotifyImageSize

# Join uses the http protocol with JSON requests
JOIN_URL = 'https://joinjoaomgcd.appspot.com/_ah/api/messaging/v1/sendPush'

# Token required as part of the API request
VALIDATE_APIKEY = re.compile(r'[A-Za-z0-9]{32}')

# Default User
JOIN_DEFAULT_USER = '******'

# Extend HTTP Error Messages
JOIN_HTTP_ERROR_MAP = dict(HTTP_ERROR_MAP.items() + {
    401: 'Unauthorized - Invalid Token.',
}.items())

# Used to break path apart into list of devices
DEVICE_LIST_DELIM = re.compile(r'[ \t\r\n,\\/]+')

# Used to detect a device
IS_DEVICE_RE = re.compile(r'([A-Za-z0-9]{32})')

# Used to detect a device
IS_GROUP_RE = re.compile(
    r'(group\.)?(?P<name>(all|android|chrome|windows10|phone|tablet|pc))',
    re.IGNORECASE,
)
Exemplo n.º 5
0
import requests
import re

from NotifyBase import NotifyBase
from NotifyBase import NotifyFormat
from NotifyBase import NotifyImageSize
from NotifyBase import HTTP_ERROR_MAP

# Pushalot uses the http protocol with JSON requests
PUSHALOT_URL = 'https://pushalot.com/api/sendmessage'

# Image Support (72x72)
PUSHALOT_IMAGE_XY = NotifyImageSize.XY_72

# Extend HTTP Error Messages
PUSHALOT_HTTP_ERROR_MAP = dict(HTTP_ERROR_MAP.items() + {
    406: 'Message throttle limit hit.',
    410: 'AuthorizedToken is no longer valid.',
}.items())

# Used to validate Authorization Token
VALIDATE_AUTHTOKEN = re.compile(r'[A-Za-z0-9]{32}')

class NotifyPushalot(NotifyBase):
    """
    A wrapper for Pushalot Notifications
    """
    def __init__(self, authtoken, is_important=False, **kwargs):
        """
        Initialize Pushalot Object
        """
Exemplo n.º 6
0
# You should have received a copy of the GNU General Public License
# along with NZB-Notify. If not, see <http://www.gnu.org/licenses/>.

import requests
import re

from NotifyBase import NotifyBase
from NotifyBase import NotifyFormat
from NotifyBase import HTTP_ERROR_MAP

# Notify My Android uses the http protocol with JSON requests
NMA_URL = 'https://www.notifymyandroid.com/publicapi/notify'

# Extend HTTP Error Messages
NMA_HTTP_ERROR_MAP = dict(
    HTTP_ERROR_MAP.items() + {
        400: 'Data is wrong format, invalid length or null.',
        401: 'API Key provided is invalid',
        402: 'Maximum number of API calls per hour reached.',
    }.items())

# Used to validate Authorization Token
VALIDATE_APIKEY = re.compile(r'[A-Za-z0-9]{48}')


# Priorities
class NotifyMyAndroidPriority(object):
    VERY_LOW = -2
    MODERATE = -1
    NORMAL = 0
    HIGH = 1
Exemplo n.º 7
0
#  /AAAAAAAAA/........./........................
VALIDATE_TOKEN_A = re.compile(r'[A-Z0-9]{9}')

# Token required as part of the API request
#  /........./BBBBBBBBB/........................
VALIDATE_TOKEN_B = re.compile(r'[A-Z0-9]{9}')

# Token required as part of the API request
#  /........./........./CCCCCCCCCCCCCCCCCCCCCCCC
VALIDATE_TOKEN_C = re.compile(r'[A-Za-z0-9]{24}')

# Default User
SLACK_DEFAULT_USER = '******'

# Extend HTTP Error Messages
SLACK_HTTP_ERROR_MAP = dict(HTTP_ERROR_MAP.items() + {
    401: 'Unauthorized - Invalid Token.',
}.items())

# Used to break path apart into list of devices
CHANNEL_LIST_DELIM = re.compile(r'[ \t\r\n,#\\/]+')

# Used to detect a device
IS_CHANNEL_RE = re.compile(r'#?([A-Za-z0-9_]{1,32})')

# Image Support (72x72)
SLACK_IMAGE_XY = NotifyImageSize.XY_72


class NotifySlack(NotifyBase):
    """