Python bindings for the Growl Notification Transport Protocol
Bugs can be reported at the GitHub issue tracker
The gntp.notifier module is provided as a simple way to send notifications using GNTP
Note
This class is intended to mostly mirror the older Python bindings such that you should be able to replace instances of the old bindings with this class. Original Python bindings
Single notification function
Simple notification function in one line. Has only one required parameter and attempts to use reasonable defaults for everything else :param string description: Notification message
Helper class to simplfy sending Growl messages
| Parameters: |
|
|---|
Add optional Origin headers to message
Send a GNTP notifications
Warning
Must have registered with growl beforehand or messages will be ignored
| Parameters: |
|
|---|
Send GNTP Registration
Warning
Before sending notifications to Growl, you need to have sent a registration message at least once
Send a Subscribe request to a remote machine
import gntp.notifier
# Simple "fire and forget" notification
gntp.notifier.mini("Here's a quick message")
# More complete example
growl = gntp.notifier.GrowlNotifier(
applicationName = "My Application Name",
notifications = ["New Updates","New Messages"],
defaultNotifications = ["New Messages"],
# hostname = "computer.example.com", # Defaults to localhost
# password = "abc123" # Defaults to a blank password
)
growl.register()
# Send one message
growl.notify(
noteType = "New Messages",
title = "You have a new message",
description = "A longer message description",
icon = "http://example.com/icon.png",
sticky = False,
priority = 1,
)
# Try to send a different type of message
# This one may fail since it is not in our list
# of defaultNotifications
growl.notify(
noteType = "New Updates",
title = "There is a new update to download",
description = "A longer message description",
icon = "http://example.com/icon.png",
sticky = False,
priority = -1,
)