CtrlK
CommunityDocumentationLog inGet started
Tessl Logo

tessl/pypi-gntp

tessl install tessl/pypi-gntp@1.0.0

Growl Notification Transport Protocol for Python

Agent Success

Agent success rate when using this tile

80%

Improvement

Agent success rate improvement when using this tile compared to baseline

1.25x

Baseline

Agent success rate without this tile

64%

task.mdevals/scenario-8/

GNTP Notification Monitor

A monitoring utility that sends notifications to a Growl server and handles protocol-level errors gracefully.

Overview

Build a notification monitoring system that sends notifications to a Growl server and implements robust error handling for protocol-level failures. The system should be able to distinguish between different types of errors and handle them appropriately.

Capabilities

Send notifications with error handling

  • Sends a notification with title "Test Notification" and description "Hello from monitor" to localhost and handles any GNTPError responses @test
  • Returns the error code when a GNTPError occurs during notification sending @test

Parse and categorize protocol errors

  • Distinguishes between authentication errors (error code 401) and other protocol errors @test
  • Extracts the error description from a GNTPError response @test

Implement error recovery

  • Retries notification after authentication failure with correct password @test
  • Does not retry for unrecoverable errors (error codes 400, 500) @test

Implementation

@generates

API

class NotificationMonitor:
    """
    A notification monitor that sends notifications and handles protocol errors.
    """

    def __init__(self, hostname='localhost', port=23053, password=None):
        """
        Initialize the notification monitor.

        Args:
            hostname: The Growl server hostname
            port: The Growl server port
            password: Optional password for authentication
        """
        pass

    def send_notification(self, title, description, app_name='Monitor', retry_on_auth_error=False, fallback_password=None):
        """
        Send a notification to the Growl server with error handling.

        Args:
            title: Notification title
            description: Notification description
            app_name: Application name for registration
            retry_on_auth_error: Whether to retry with fallback_password on auth error
            fallback_password: Password to use for retry on authentication failure

        Returns:
            dict with keys:
                - 'success': bool indicating if notification was sent successfully
                - 'error_code': int error code if a GNTPError occurred, None otherwise
                - 'error_description': str error description if a GNTPError occurred, None otherwise
                - 'retried': bool indicating if a retry was attempted
        """
        pass

    def is_authentication_error(self, error_code):
        """
        Check if an error code represents an authentication failure.

        Args:
            error_code: The GNTP error code

        Returns:
            bool: True if error code is 401 (authentication error)
        """
        pass

    def is_recoverable_error(self, error_code):
        """
        Check if an error is recoverable and should be retried.

        Args:
            error_code: The GNTP error code

        Returns:
            bool: True if the error is recoverable (not 400 or 500 range errors)
        """
        pass

Dependencies { .dependencies }

gntp { .dependency }

Provides Growl Notification Transport Protocol implementation with error handling support.

@satisfied-by

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/gntp@1.0.x
tile.json