Skip to content

Commit

Permalink
Add a way to use EduStudent with a StudentOnly id
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanhrabcak committed Mar 30, 2023
1 parent 0b50a13 commit a8c6ada
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion edupage_api/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@ def send_message(self, recipients: Union[list[EduAccount], EduAccount, list[str]

changes = response.get("changes")
if changes == [] or changes is None:
raise RequestError("Failed to send message (edupage returned an empty 'changes' array)")
raise RequestError("Failed to send message (edupage returned an empty 'changes' array) - https://github.com/ivanhrabcak/edupage-api/issues/62")

return int(changes[0].get("timelineid"))
11 changes: 11 additions & 0 deletions edupage_api/people.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,17 @@ def __init__(self, person_id: int, name: str, gender: Gender, in_school_since: d
self.class_id = class_id
self.number_in_class = number_in_class

self.__student_only = False

def get_id(self):
if not self.__student_only:
return super().get_id()
else:
return super().get_id().replace("Student", "StudentOnly")

def set_student_only(self, student_only: bool):
self.__student_only = student_only


@dataclass
class EduStudentSkeleton:
Expand Down

0 comments on commit a8c6ada

Please sign in to comment.