bin/notifo_cli.py
def main():
    """ main function """
    # get options and arguments
    (parser, options, args) = init_parser()

    # initialize result variable
    result = None

    # check for values which are always needed
    if not options.user:
        parser.error("No user given.")
    if not options.secret:
        parser.error("No API secret given.")
    if not options.name:
        parser.error("No recipient given.")

    # If there is no message, we probably want to subscribe a user
    if len(args) < 1:
        result = notifo.subscribe_user(options.user, options.secret, options.name)
    else:
        params = {}
        params["to"] = options.name
        m = ''
        for a in args:
            m = "%s %s" %(m, a)
        params["msg"] = m

        if options.message == True:
            result = notifo.send_message(options.user, options.secret, **params)
        else:
            if options.label:
                params["label"] = options.label
            if options.title:
                params["title"] = options.title
            if options.callback:
                params["uri"] = options.callback
            result = notifo.send_notification(options.user,options.secret,
                                              **params)

    if result is None:
        print "Something went wrong. Check parameters and try again."
def main():
    """ main function """
    # get options and arguments
    (parser, options, args) = init_parser()

    # initialize result variable
    result = None

    # check for values which are always needed
    if not options.user:
        parser.error("No user given.")
    if not options.secret:
        parser.error("No API secret given.")
    if not options.name:
        parser.error("No recipient given.")

    # If there is no message, we probably want to subscribe a user
    if len(args) < 1:
        result = notifo.subscribe_user(options.user, options.secret, options.name)
    else:
        params = {}
        params["to"] = options.name
        m = ''
        for a in args:
            m = "%s %s" %(m, a)
        params["msg"] = m

        if options.message == True:
            result = notifo.send_message(options.user, options.secret, **params)
        else:
            if options.label:
                params["label"] = options.label
            if options.title:
                params["title"] = options.title
            if options.callback:
                params["uri"] = options.callback
            result = notifo.send_notification(options.user,options.secret,
                                              **params)

    if result is None:
        print "Something went wrong. Check parameters and try again."
def main ( ) : # get options and arguments ( parser , options , args ) = init_parser ( ) # initialize result variable result = None # check for values which are always needed if not options . user : parser . error ( "No user given." ) if not options . secret : parser . error ( "No API secret given." ) if not options . name : parser . error ( "No recipient given." ) # If there is no message, we probably want to subscribe a user if len ( args ) < 1 : result = notifo . subscribe_user ( options . user , options . secret , options . name ) else : params = { } params [ "to" ] = options . name m = '' for a in args : m = "%s %s" % ( m , a ) params [ "msg" ] = m if options . message == True : result = notifo . send_message ( options . user , options . secret , * * params ) else : if options . label : params [ "label" ] = options . label if options . title : params [ "title" ] = options . title if options . callback : params [ "uri" ] = options . callback result = notifo . send_notification ( options . user , options . secret , * * params ) if result is None : print "Something went wrong. Check parameters and try again."
main function
main function