Schedule notifications

Use the notifications to schedule notifications that can be delivered even if Pyto isn’t opened.

class notifications.Notification(message: str = None, url: str = None, actions: dict = None)

A class representing a notification.

actions = None

Additional actions on the notification.

A dictionary with the name of the action and the URL to open.

message = None

The body of the notification.

url = None

The URL to open when the notification is opened.

notifications.UNUserNotificationCenter = None

The ‘UNUserNotificationCenter’ class from the UserNotifications framework.


Cancels all pending notifications.

notifications.cancel_notification(notification: notifications.Notification)

Cancels a pending notification.

Parameters:notification – The Notification object returned from get_pending_notifications().
notifications.get_pending_notifications() → List[notifications.Notification]

Returns a list of pending notifications. Notifications cannot be modified after being scheduled.

Return type:List[Notification]

Removes all delivered notifications from the Notification Center.

notifications.schedule_notification(notification: notifications.Notification, delay: float, repeat: bool)

Schedules a notification.

  • Notification – The Notification object representing the notification content.
  • delay – The time interval in seconds until the notification is delivered.
  • repeat – A boolean indicating whether the notification delivery should be repeated indefinitely.
notifications.send_notification(notification: notifications.Notification)

Sends the given notification immediately.

Parameters:Notification – The Notification object representing the notification content.