def _send_notify(message, growlhost, growlport): if not growlhost: host = autosub.GROWLHOST if growlhost: host = growlhost if not growlport: port = int(autosub.GROWLPORT) if growlport: port = int(growlport) try: s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect((host, port)) s.send(message) gntp.parse_gntp(s.recv(1024)) s.close() log.info("Notification sent.") return True except socket.error: log.error("Notification failed.") return False
def _send_notify(message, growlhost, growlport): if not growlhost: host = autosub.GROWLHOST if growlhost: host = growlhost if not growlport: port = int(autosub.GROWLPORT) if growlport: port = int(growlport) try: s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect((host, port)) s.send(message) gntp.parse_gntp(s.recv(1024)) s.close() log.info("Growl: notification sent.") return True except socket.error: log.error("Growl: notification failed.") return False
def _send_notify(message): host = autosub.GROWLHOST port = int(autosub.GROWLPORT) try: s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect((host, port)) s.send(message) gntp.parse_gntp(s.recv(1024)) s.close() log.info("Growl: Message sent") return True except socket.error: log.error("Growl: Failed to sent message, could not bind to socket. Sure growl is running and I can connect to it?") return False
def send_growl(host, port, message): try: s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect((host, port)) s.send(message) response = gntp.parse_gntp(s.recv(1024)) s.close() print "Growl notification send" except socket.error: print "ERROR: Unable to send growl notification to growl server. Check your settings."
def _send_notify(message): host = autosub.GROWLHOST port = int(autosub.GROWLPORT) try: s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect((host, port)) s.send(message) gntp.parse_gntp(s.recv(1024)) s.close() log.info("Growl: Message sent") return True except socket.error: log.error( "Growl: Failed to sent message, could not bind to socket. Sure growl is running and I can connect to it?" ) return False