notifications¶
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.
-
notifications.
cancel_all
()¶ Cancels all pending notifications.
-
notifications.
cancel_notification
(notification: notifications.Notification)¶ Cancels a pending notification.
Parameters: notification – The Notification
object returned fromget_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]
-
notifications.
remove_delivered_notifications
()¶ Removes all delivered notifications from the Notification Center.
-
notifications.
schedule_notification
(notification: notifications.Notification, delay: float, repeat: bool)¶ Schedules a notification.
Parameters: - 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.
- Notification – The
-
notifications.
send_notification
(notification: notifications.Notification)¶ Sends the given notification immediately.
Parameters: Notification – The Notification
object representing the notification content.