def SendNotificationToNotifo(status,message,notifoUsername,notifoApiKey): notifoDict = {"to":notifoUsername,"msg":message,"label":"Gamez","title":"Gamez Download Alert"} try: notifo = Notifo(notifoUsername,notifoApiKey) LogEvent("Notifo Response: " + notifo.sendNotification(notifoDict)) except Exception,msg: LogEvent("Growl Notification Error: " + msg)
if v is not None: d[k] = v return d usage=""" %prog -t "auser" -m "Hey! How are you?" See https://api.notifo.com/ for more information. """ parser = optparse.OptionParser(usage=usage) parser.add_option("-t", "--to", action="store", help="Set the 'to' parameter.", type="string") parser.add_option("-m", "--msg", action="store", help="Set the message to send.", type="string") parser.add_option("-l", "--label", action="store", help="Set the label for the application.", type="string") parser.add_option("-i", "--title", action="store", help="Set the title for the notification message.", type="string") parser.add_option("-u", "--uri", action="store", help="Set the message callback URI.", type="string") (options, args) = parser.parse_args() notifo = Notifo(user, key) params = parseOptions(vars(options)) if not params.has_key("to"): print "You must specify the --to parameter." sys.exit(1) if not params.has_key("msg"): print "You must specify the --msg parameter." sys.exit(1) print notifo.sendNotification(params)