mediahandler.util.notify¶
Module: mediahandler.util.notify
Module contains:
- mediahandler.util.notify.MHPush
An object which contains the all the logic for sending push notifications and raising errors produced by mediahandler.
- class mediahandler.util.notify.MHPush(settings, disable=False)¶
Bases: mediahandler.MHObject
An object which contains the all the logic for sending push notifications and raising errors produced by mediahandler.
- Arguments:
- settings
Required. Dict or MHSettings object.
- disable
True/False.
Public methods:
- mediahandler.util.notify.MHPush.send_message()
Wrapper function for sending push notification messages via various 3rd party services.
- mediahandler.util.notify.MHPush.success()
A wrapper for send_message() which sends a success message and returns message content.
- mediahandler.util.notify.MHPush.failure()
A wrapper for send_message() which sends a failure message and raises a SystemExit.
- class MHSettings(adict)¶
Bases: object
Object which serves as a simple structure for storing data as attributes.
- MHPush.failure(error_details)¶
Builds and sends a failure notification.
Required argument:
- error_details
String. A message detailing the error that was reported during the add_media() sequence.
- MHPush.send_message(conn_msg, msg_title=None)¶
Wrapper for sending push notifications via 3rd party services.
The function will exit if the disable flag is set.
- MHPush.set_settings(adict)¶
Iteratively converts a dict into MHSettings objects and subsequently into object attributes.
- MHPush.success(file_array, skipped=None)¶
Builds and sends a success notification.
Arguments:
- file_array
Required. An array of the files added via the mediahandler.handler.add_media() function.
- skipped
Defaults to None. An array of any files that were skipped during the add_media() sequence.