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