GNTP Basics

Python bindings for the Growl Notification Transport Protocol

Bugs can be reported at the GitHub issue tracker

Simple Message Sending

from gntp.notifier import mini
# Send a simple growl message with mostly default values
mini("Here's a quick message", callback=""), applicationName='PythonMini', noteType='Message', title='Mini Message', applicationIcon=None, hostname='localhost', password=None, port=23053, sticky=False, priority=None, callback=None, notificationIcon=None, identifier=None, notifierFactory=<class 'gntp.notifier.GrowlNotifier'>)

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


For now, only URL callbacks are supported. In the future, the callback argument will also support a function

Detailed Message Sending

class gntp.notifier.GrowlNotifier(applicationName='Python GNTP', notifications=[], defaultNotifications=None, applicationIcon=None, hostname='localhost', password=None, port=23053)

Helper class to simplfy sending Growl messages

  • applicationName (string) – Sending application name
  • notification (list) – List of valid notifications
  • defaultNotifications (list) – List of notifications that should be enabled by default
  • applicationIcon (string) – Icon URL
  • hostname (string) – Remote host
  • port (integer) – Remote port

The GrowlNotifier class is intended to mostly mirror the older python bindings for growl


Send GNTP Registration


Before sending notifications to Growl, you need to have sent a registration message at least once

GrowlNotifier.notify(noteType, title, description, icon=None, sticky=False, priority=None, callback=None, identifier=None, custom={})

Send a GNTP notifications


Must have registered with growl beforehand or messages will be ignored

  • noteType (string) – One of the notification names registered earlier
  • title (string) – Notification title (usually displayed on the notification)
  • description (string) – The main content of the notification
  • icon (string) – Icon URL path
  • sticky (boolean) – Sticky notification
  • priority (integer) – Message priority level from -2 to 2
  • callback (string) – URL callback
  • custom (dict) – Custom attributes. Key names should be prefixed with X- according to the spec but this is not enforced by this class


For now, only URL callbacks are supported. In the future, the callback argument will also support a function

GrowlNotifier.subscribe(id, name, port)

Send a Subscribe request to a remote machine

Complete Example

import gntp.notifier

# Simple "fire and forget" notification"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 = "", # Defaults to localhost
        # password = "abc123" # Defaults to a blank password

# Send one message
        noteType = "New Messages",
        title = "You have a new message",
        description = "A longer message description",
        icon = "",
        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
        noteType = "New Updates",
        title = "There is a new update to download",
        description = "A longer message description",
        icon = "",
        sticky = False,
        priority = -1,

# Send the image with the growl notification
image = open('/path/to/icon.png', 'rb').read()
        noteType = "New Messages",
        title = "Now with icons",
        description = "This time we attach the image",
        icon = image,

GNTP Configfile Example

class gntp.config.GrowlNotifier(*args, **kwargs)

ConfigParser enhanced GrowlNotifier object

For right now, we are only interested in letting users overide certain values from ~/.gntp

hostname = ?
password = ?
port = ?