Welcome to notify’s documentation!¶
notify¶
Notify process termination via email. It support Python 2.4 and later (Python 2.4 and Python 2.5 were manually tested, so it might not work).
Installation¶
Use pip like:
$ pip install notify
Additionally, if you would like to use a mail user agent which requires authentication, installing keyring is strongly recommended:
$ pip install keyring
Usage¶
Running notify with the following command will start a setup wizard the first time.
$ notify
Follow the setup wizard instructions.
Check with the following command (Only for Unix system)
$ notify --check
Sample usage of notify
$ notify really_havy_process -a -b --options $ notify -t different@address.com really_havy_process -a -b --options
API documentation¶
notify Package¶
arguments
Module¶
-
notify.arguments.
parse_arguments
(args, config)[source]¶ Parse specified arguments via config
Parameters: args : list
Command line arguments
config : object
ConfigParser instance which values are used as default values of options
Returns: list : arguments, options
options indicate the return value of ArgumentParser and arguments indicate the execution command/arguments
-
notify.arguments.
split_arguments
(args)[source]¶ Split specified arguments to two list.
This is used to distinguish the options of the program and execution command/arguments.
Parameters: args : list
Command line arguments
Returns: list : options, arguments
options indicate the optional arguments for the program and arguments indicate the execution command/arguments
compat
Module¶
Compatibility module
conf
Module¶
executor
Module¶
A terminal command executor module
-
notify.executor.
call
(args)[source]¶ Call terminal command and return exit_code and stdout
Parameters: args : list
A command and arguments list
Returns: list : [exit_code, stdout]
exit_code indicate the exit code of the command and stdout indicate the output of the command
-
notify.executor.
from_unicode
(x, e)¶
mailer
Module¶
Mailer module
-
notify.mailer.
create_message
(from_addr, to_addr, subject, body, encoding=None)[source]¶ Create message object for sending email
Parameters: from_addr : string
An email address used for ‘From’ attribute
to_addr : string
An email address used for ‘To’ attribute
subject : string
An email subject string
body : string
An email body string
encoding : string
An email encoding string (Default: utf8)
Returns: object
An instance of email.mime.text.MIMEText
-
notify.mailer.
send_email
(msg, host='localhost', port=25, username=None, password=None)[source]¶ Send an email (via TLS when username and password are specified)
Parameters: msg : object
An instance of MIMEText. Create this with
create_message()
function.host : string
A mail user agent host name (Default: localhost)
port : int
A mail user agent port number (Default: 25)
username : string
A username string used to login MUA via TLS authentication
password : string
A password string used to login MUA via TLS authentication
debug : boolean
True for displaying debug messages
notifier
Module¶
wizard
Module¶
A notify setup wizard module
-
notify.wizard.
console_input
(default, validation=None, allow_empty=False)[source]¶ Get user input value from stdin
Parameters: default : string
A default value. It will be used when user input nothing.
validation : callable
A validation function. The validation function must raise an error when validation has failed.
Returns: string or any
A user input string or validated value
Subpackages¶
utils Package¶
plaintext_keyring
Module¶
Plaintext keyring module
terminalsize
Module¶
-
notify.utils.terminalsize.
get_terminal_size
()[source]¶ getTerminalSize() - get width and height of console - works on linux,os x,windows,cygwin(windows) originally retrieved from: http://stackoverflow.com/questions/566746/how-to-get-console-window-width-in-python