From c72c99567adaba8ad74750228cbd1cf4200841df Mon Sep 17 00:00:00 2001 From: ShadowMikado <89030950+ShadowMikado@users.noreply.github.com> Date: Sat, 18 Nov 2023 22:03:18 +0100 Subject: [PATCH 1/3] Update clients.py --- pronotepy/clients.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/pronotepy/clients.py b/pronotepy/clients.py index 16fef7f..a2fc7d3 100644 --- a/pronotepy/clients.py +++ b/pronotepy/clients.py @@ -574,6 +574,23 @@ def generate_timetable_pdf( + response["donneesSec"]["donnees"]["url"]["V"] ) + def notifications(self) -> List[dataClasses.Notifications]: + """the notification""" + + response = self.post("CentraleNotifications", 7) + n_list = response["donneesSec"]["donnees"]["liste"]["V"] + out = [] + for n_test in n_list: + no = dataClasses.Notifications(n_test) + out.append(no) + return out + + @property + def notification_number(self) -> int: + response = self.post("CentraleNotifications", 7) + notif_number = response["donneesSec"]["donnees"].get("nbNotifs") + return notif_number + def get_recipients(self) -> List[dataClasses.Recipient]: """Get recipients for new discussion From d2d33e9ae5ff433c564754c01b34d30fbb71444d Mon Sep 17 00:00:00 2001 From: ShadowMikado <89030950+ShadowMikado@users.noreply.github.com> Date: Sat, 18 Nov 2023 22:05:13 +0100 Subject: [PATCH 2/3] Update dataClasses.py --- pronotepy/dataClasses.py | 41 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/pronotepy/dataClasses.py b/pronotepy/dataClasses.py index 1cddbdc..0d34c30 100644 --- a/pronotepy/dataClasses.py +++ b/pronotepy/dataClasses.py @@ -2166,3 +2166,44 @@ def __init__(self, json_dict: dict) -> None: ) del self._resolver + + + +class Notifications(Object): + + """ + Represents the notifications. You shouldn't have to create this class manually. + + Attributes: + part (str): part of the notification + ident (str): ident of the notification + """ + + def __init__(self, json_dict: dict) -> None: + super().__init__(json_dict) + + self.part: str = self._resolver(str, "L") + self.ident: str = self._resolver(str, "ident") + + self.notifications: List[Notifications.Notification] = self._resolver( + lambda x: [Notifications.Notification(i) for i in x], "liste", "V" + ) + del self._resolver + + class Notification(Object): + """ + Represents the notification. You shouldn't have to create this class manually. + + Attributes: + id (str): id of the notification + message (str): message of the notification + type (int): type of the notification + action (int): action of the notification + """ + def __init__(self, json_dict: dict) -> None: + super().__init__(json_dict) + + self.id: str = self._resolver(str, "id") + self.message: str = self._resolver(str, "message", "V") + self.type: int = self._resolver(int, "type") + self.action: int = self._resolver(int, "action") From cf625436d4e4f74e21af1d082edd9ff102471c06 Mon Sep 17 00:00:00 2001 From: ShadowMikado <89030950+ShadowMikado@users.noreply.github.com> Date: Sat, 18 Nov 2023 22:14:23 +0100 Subject: [PATCH 3/3] Update dataClasses.py (notifications) --- pronotepy/dataClasses.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pronotepy/dataClasses.py b/pronotepy/dataClasses.py index 0d34c30..605294e 100644 --- a/pronotepy/dataClasses.py +++ b/pronotepy/dataClasses.py @@ -63,6 +63,7 @@ "Delay", "TeachingStaff", "Report", + "Notifications" ) log = logging.getLogger(__name__)