Skip to content

Commit de806d8

Browse files
committed
Support None as input
1 parent 98bce68 commit de806d8

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

edupage_api/classes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def get_classes(self) -> Optional[list]:
5959
def get_class(self, class_id: int | str) -> Optional[Class]:
6060
try:
6161
class_id = int(class_id)
62-
except ValueError:
62+
except (ValueError, TypeError):
6363
return None
6464

6565
return next(

edupage_api/classrooms.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def get_classrooms(self) -> Optional[list]:
3939
def get_classroom(self, classroom_id: int | str) -> Optional[Classroom]:
4040
try:
4141
classroom_id = int(classroom_id)
42-
except ValueError:
42+
except (ValueError, TypeError):
4343
return None
4444

4545
return next(

edupage_api/people.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ def get_all_students(self) -> Optional[list[EduStudent]]:
218218
def get_teacher(self, teacher_id: int | str) -> Optional[EduTeacher]:
219219
try:
220220
teacher_id = int(teacher_id)
221-
except ValueError:
221+
except (ValueError, TypeError):
222222
return None
223223

224224
return next(
@@ -234,7 +234,7 @@ def get_teacher(self, teacher_id: int | str) -> Optional[EduTeacher]:
234234
def get_student(self, student_id: int | str) -> Optional[EduStudent]:
235235
try:
236236
student_id = int(student_id)
237-
except ValueError:
237+
except (ValueError, TypeError):
238238
return None
239239

240240
return next(

edupage_api/subjects.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def get_subjects(self) -> Optional[list]:
3939
def get_subject(self, subject_id: int | str) -> Optional[Subject]:
4040
try:
4141
subject_id = int(subject_id)
42-
except ValueError:
42+
except (ValueError, TypeError):
4343
return None
4444

4545
return next(

0 commit comments

Comments
 (0)