From 204f130d9fc295faeb375f28d486d972525d71de Mon Sep 17 00:00:00 2001 From: Suraj B M Date: Wed, 24 Apr 2024 09:59:18 +0530 Subject: [PATCH] feat: add seating info handler to main package --- pesuacademy/pesuacademy.py | 12 ++++++++++++ pesuacademy/util/page.py | 3 +++ 2 files changed, 15 insertions(+) diff --git a/pesuacademy/pesuacademy.py b/pesuacademy/pesuacademy.py index 9032018..99e78ea 100644 --- a/pesuacademy/pesuacademy.py +++ b/pesuacademy/pesuacademy.py @@ -4,6 +4,7 @@ from bs4 import BeautifulSoup from pesuacademy import util +from pesuacademy.models.seating_info import SeatingInfo from pesuacademy.util.page import PageHandler from .exceptions import CSRFTokenError, AuthenticationError from .models import Profile, ClassAndSectionInfo, Course @@ -155,3 +156,14 @@ def attendance(self, semester: Optional[int] = None) -> dict[int, list[Course]]: raise AuthenticationError("You need to authenticate first.") attendance_info = self.page_handler.get_attendance(semester) return attendance_info + + def seating_info(self) -> list[SeatingInfo]: + """ + Get the seating information of the currently authenticated user. + + :return: The seating information. + """ + if not self._authenticated: + raise AuthenticationError("You need to authenticate first.") + seating_info = self.page_handler.get_seating_info() + return seating_info \ No newline at end of file diff --git a/pesuacademy/util/page.py b/pesuacademy/util/page.py index c46018a..0d548a5 100644 --- a/pesuacademy/util/page.py +++ b/pesuacademy/util/page.py @@ -80,3 +80,6 @@ def get_courses(self, semester: Optional[int] = None): def get_attendance(self, semester: Optional[int] = None): semester_ids = self.get_semester_ids_from_semester_number(semester) return self.attendance_page_handler.get_page(self.__session, semester_ids) + + def get_seating_info(self): + return pages.SeatingInfoHandler.get_page(self.__session) \ No newline at end of file