Module edupage_api.classrooms
Classes
class Classroom (classroom_id: int, name: str, short: str)
-
Classroom(classroom_id: int, name: str, short: str)
Expand source code
@dataclass class Classroom: classroom_id: int name: str short: str
Class variables
var classroom_id : int
var name : str
var short : str
class Classrooms (edupage: EdupageModule)
-
Expand source code
class Classrooms(Module): @ModuleHelper.logged_in def get_classrooms(self) -> Optional[list]: classroom_list = DbiHelper(self.edupage).fetch_classroom_list() if classroom_list is None: return None classrooms = [] for classroom_id_str in classroom_list: if not classroom_id_str: continue classrooms.append( Classroom( int(classroom_id_str), classroom_list[classroom_id_str]["name"], classroom_list[classroom_id_str]["short"], ) ) return classrooms def get_classroom(self, classroom_id: Union[int, str]) -> Optional[Classroom]: try: classroom_id = int(classroom_id) except (ValueError, TypeError): return None return next( ( classroom for classroom in self.get_classrooms() if classroom.classroom_id == classroom_id ), None, )
Ancestors
Methods
def get_classroom(self, classroom_id: Union[int, str]) ‑> Optional[Classroom]
def get_classrooms(self) ‑> Optional[list]