tessl install tessl/pypi-gntp@1.0.0Growl 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%
Build a notification sender that validates server responses and handles various error conditions properly.
Your task is to implement a notification system with the following features:
Your implementation must handle the following error scenarios:
@generates
class NotificationClient:
"""
A notification client that sends notifications with proper error handling.
"""
def __init__(self, hostname='localhost', port=23053, password=None):
"""
Initialize the notification client.
Args:
hostname: The server hostname
port: The server port
password: Optional password for authentication
"""
pass
def register(self, app_name, notification_types):
"""
Register the application with the server.
Args:
app_name: Name of the application
notification_types: List of notification type names to register
Raises:
ConnectionError: If unable to connect to the server
ValueError: If the server response is invalid
AuthenticationError: If authentication fails
"""
pass
def send_notification(self, notification_type, title, description=''):
"""
Send a notification to the server.
Args:
notification_type: The type of notification (must be registered)
title: Notification title
description: Optional notification description
Raises:
ConnectionError: If unable to connect to the server
ValueError: If the server response is invalid or notification type not registered
AuthenticationError: If authentication fails
"""
pass
class AuthenticationError(Exception):
"""Raised when authentication with the server fails."""
passProvides GNTP protocol implementation for sending notifications.