raspc-notif documentation

This module provides a Python wrapper for the RaspController notification library.

It allows you to send push notifications from your Raspberry Pi (or other compatible device) to the RaspController mobile application.

class raspc_notif.notif.Notification(title, message, high_priority=False)

Bases: object

A data class that holds the content for a single notification.

has_valid_message()

Checks if the message is valid (is a non-empty string).

has_valid_title()

Checks if the title is valid (is None or a string).

class raspc_notif.notif.Result(status, message)

Bases: object

Represents the result of a notification sending operation.

It contains a status code (e.g., SUCCESS, SOCKET_ERROR) and a descriptive message from the library.

INVALID_APIKEY = 4
INVALID_PARAMETER = 5
NO_TOKEN_FOUND = 6
SERVER_ERROR = 3
SOCKET_ERROR = 1
SUCCESS = 0
TOO_MANY_REQUESTS = 2
class raspc_notif.notif.Sender(apikey)

Bases: object

The main class for sending notifications.

It requires an API key to authenticate with the RaspController notification service.

send_notification(notification)

Attempts to send a notification.

It validates the notification object and returns the result.

Args:

notification (Notification): The Notification object to be sent.

Returns:
Result: A Result object indicating the status (success or error)

of the send operation.