notify Package

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

notify.conf.config_to_options(config)[source]

Convert ConfigParser instance to argparse.Namespace

Parameters:

config : object

A ConfigParser instance

Returns:

object

An argparse.Namespace instance

notify.conf.create_default_config()[source]

Create default ConfigParser instance

notify.conf.get_user_config_filename(appname='notify')[source]

Get user config filename.

It will return operating system dependent config filename.

Parameters:

appname : string

An application name used for filename

Returns:

string

A filename of user configuration.

console Module

notify.console.main(args=None)[source]

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)
notify.executor.get_command_str(args)[source]

Get terminal command string from list of command and arguments

Parameters:

args : list

A command and arguments list (unicode list)

Returns:

str

A string indicate terminal command

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

notify.notifier.call_and_notificate(args, opts)[source]

Execute specified arguments and send notification email

Parameters:

args : list

A execution command/arguments list

opts : object

A option instance

wizard Module

A notify setup wizard module

exception notify.wizard.ValidationError[source]

Bases: exceptions.Exception

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

notify.wizard.setup_wizard(config)[source]
notify.wizard.validate_email(x)[source]
notify.wizard.validate_int(x)[source]