Package pushnotify :: Module pushover :: Class Client
[hide private]
[frames] | no frames]

Class Client

source code

             object --+    
                      |    
abstract.AbstractClient --+
                          |
                         Client

Client for sending push notifications to Android and iOS devices
with the Pushover application installed.

Member Vars:
    developerkey: A string containing a valid token for the Pushover
        application.
    application: A string containing the name of the application on
        behalf of whom the Pushover client will be sending messages.
        Not used by this client.
    apikeys: A dictionary where the keys are strings containing
        valid user identifier, and the values are lists of strings,
        each containing a valid device identifier.

Instance Methods [hide private]
 
__init__(self, developerkey, application='')
Initialize the Pushover client.
source code
 
_parse_response(self, stream, verify=False) source code
 
_raise_exception(self) source code
 
notify(self, description, event, split=True, kwargs=None)
Send a notification to each user/device combintation in self.apikeys.
source code
 
verify_user(self, apikey)
Verify a user identifier.
source code
 
verify_device(self, apikey, device_key)
Verify a device identifier for the user given by apikey.
source code

Inherited from abstract.AbstractClient: add_key, del_key, retrieve_apikey, retrieve_token

Inherited from abstract.AbstractClient (private): _get, _post

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, developerkey, application='')
(Constructor)

source code 
Initialize the Pushover client.

Args:
    developerkey: A string containing a valid token for the
        Pushover application.
    application: A string containing the name of the application
        on behalf of whom the Pushover client will be sending
        messages. Not used by this client. (default: '')

Overrides: object.__init__

notify(self, description, event, split=True, kwargs=None)

source code 
Send a notification to each user/device combintation in
self.apikeys.

As of 2012-09-18, this is not returning a 4xx status code as
per the Pushover API docs, but instead chopping the delivered
messages off at 512 characters.

Args:
    description: A string of up to DESC_LIMIT characters
        containing the notification text.
    event: A string of up to 100 characters containing a
        subject or brief description of the event.
    split: A boolean indicating whether to split long
        descriptions among multiple notifications (True) or to
        possibly raise an exception (False). (default True)
    kwargs: A dictionary with any of the following strings as
            keys:
        priority: The integer 1, which will make the
            notification display in red and override any set
            quiet hours.
        url: A string of up to 500 characters containing a URL
            to attach to the notification.
        url_title: A string of up to 50 characters containing a
            title to give the attached URL.
        (default: None)

Raises:
    pushnotify.exceptions.ApiKeyError
    pushnotify.exceptions.FormatError
    pushnotify.exceptions.RateLimitExceeded
    pushnotify.exceptions.ServerError
    pushnotify.exceptions.UnrecognizedResponseError

Overrides: abstract.AbstractClient.notify

verify_user(self, apikey)

source code 
Verify a user identifier.

Args:
    apikey: A string containing a user identifer.

Returns:
    A boolean containing True if apikey is valid, and
    False if it is not.

Overrides: abstract.AbstractClient.verify_user

verify_device(self, apikey, device_key)

source code 
Verify a device identifier for the user given by apikey.

Args:
    apikey: A string containing a user identifer.
    device_key: A string containing a device identifier.

Raises:
    pushnotify.exceptions.ApiKeyError

Returns:
    A boolean containing True if device_key is valid for
    apikey, and False if it is not.

Overrides: abstract.AbstractClient.verify_device