diff --git a/edupage_api/__init__.py b/edupage_api/__init__.py index 1511886..edc70f0 100644 --- a/edupage_api/__init__.py +++ b/edupage_api/__init__.py @@ -152,23 +152,23 @@ def send_message( return Messages(self).send_message(recipients, body) - def get_timetable(self, date: datetime) -> Optional[Timetable]: - """Get timetable. + def get_timetable(self, date: date) -> Optional[Timetable]: + """Get timetable for the logged-in user on a specified date. Args: - date (datetime): Date from which you want to get timetable. + date (datetime.date): The date for which you want to get timetable Returns: - Optional[Timetable]: Timetable object for entered date. + Optional[Timetable]: `Timetable` object for the specified date, if available; otherwise, `None`. """ return Timetables(self).get_timetable(date) - def get_lunches(self, date: datetime) -> Optional[Lunch]: + def get_lunches(self, date: date) -> Optional[Lunch]: """Get lunches. Args: - date (datetime): Date from which you want to get lunches. + date (datetime.date): Date from which you want to get lunches. Returns: Optional[Lunch]: Lunch object for entered date. @@ -274,7 +274,7 @@ def get_school_year(self) -> int: def get_foreign_timetable( self, target: Union[EduTeacher, EduStudent, Class, Classroom], - date: datetime, + date: date, ) -> Optional[list[LessonSkeleton]]: """Get timetable of a teacher, student, class, or classroom for a specific date. diff --git a/edupage_api/foreign_timetables.py b/edupage_api/foreign_timetables.py index 376727f..49d4876 100644 --- a/edupage_api/foreign_timetables.py +++ b/edupage_api/foreign_timetables.py @@ -1,6 +1,6 @@ import json from dataclasses import dataclass -from datetime import datetime, time, timedelta +from datetime import date, datetime, time, timedelta from typing import List, Optional, Union from edupage_api.classes import Class, Classes @@ -32,7 +32,7 @@ class LessonSkeleton: class ForeignTimetables(Module): - def __get_this_week_weekday(self, date: datetime, n: int) -> datetime: + def __get_this_week_weekday(self, date: date, n: int) -> date: return date - timedelta(days=(date.weekday() - n)) def get_school_year(self): @@ -43,7 +43,7 @@ def get_school_year(self): return dp.get("year") - def __get_timetable_data(self, id: int, table: str, date: datetime): + def __get_timetable_data(self, id: int, table: str, date: date): this_monday = self.__get_this_week_weekday(date, 0) this_sunday = self.__get_this_week_weekday(date, 6) @@ -92,7 +92,7 @@ def __get_timetable_data(self, id: int, table: str, date: datetime): def get_foreign_timetable( self, target: Union[EduTeacher, EduStudent, Class, Classroom], - date: datetime, + date: date, ) -> Optional[List[LessonSkeleton]]: lookup = { diff --git a/edupage_api/lunches.py b/edupage_api/lunches.py index 109d5a6..0cd9674 100644 --- a/edupage_api/lunches.py +++ b/edupage_api/lunches.py @@ -1,6 +1,6 @@ import json from dataclasses import dataclass -from datetime import datetime +from datetime import date, datetime from typing import List, Optional from edupage_api.exceptions import ( @@ -103,7 +103,7 @@ def sign_off(self, edupage: EdupageModule): class Lunches(Module): @ModuleHelper.logged_in - def get_lunch(self, date: datetime): + def get_lunch(self, date: date): date_strftime = date.strftime("%Y%m%d") request_url = ( f"https://{self.edupage.subdomain}.edupage.org/menu/?date={date_strftime}" diff --git a/edupage_api/timetables.py b/edupage_api/timetables.py index d23e490..f43e0bc 100644 --- a/edupage_api/timetables.py +++ b/edupage_api/timetables.py @@ -1,6 +1,6 @@ import json from dataclasses import dataclass -from datetime import datetime, time +from datetime import date, datetime, time from typing import List, Optional from edupage_api.classes import Class, Classes @@ -87,7 +87,7 @@ def get_last_lesson(self): class Timetables(Module): - def __get_date_plan(self, date: datetime): + def __get_date_plan(self, date: date): csrf_request_url = ( f"https://{self.edupage.subdomain}.edupage.org/dashboard/eb.php?mode=ttday" ) @@ -133,7 +133,7 @@ def __get_date_plan(self, date: datetime): return date_plans.get("plan") @ModuleHelper.logged_in - def get_timetable(self, date: datetime) -> Optional[Timetable]: + def get_timetable(self, date: date) -> Optional[Timetable]: plan = self.__get_date_plan(date) lessons = []