From b5c834146b2e2f95bf268954adbb853d921c7a74 Mon Sep 17 00:00:00 2001 From: Ivan Hrabcak Date: Sat, 1 Apr 2023 20:55:31 +0200 Subject: [PATCH] Add methods for child switching --- .gitignore | 1 + README.md | 5 +++- docs/messages.html | 6 ++-- docs/people.html | 60 +++++++++++++++++++++++++++++++++++++-- edupage_api/__init__.py | 19 ++++++++++++- edupage_api/exceptions.py | 11 ++++++- edupage_api/login.py | 5 +++- edupage_api/messages.py | 6 ++-- edupage_api/module.py | 18 +++++++++++- edupage_api/parent.py | 34 ++++++++++++++++++++++ edupage_api/people.py | 11 +++++++ setup.cfg | 2 +- 12 files changed, 164 insertions(+), 14 deletions(-) create mode 100644 edupage_api/parent.py diff --git a/.gitignore b/.gitignore index d752223..53685d2 100644 --- a/.gitignore +++ b/.gitignore @@ -15,6 +15,7 @@ build/* edupage_api.egg-info edupage_api.egg-info/* test.py +tests USERNAME PASSWORD \ No newline at end of file diff --git a/README.md b/README.md index fceca22..40ebf7d 100644 --- a/README.md +++ b/README.md @@ -31,10 +31,13 @@ except LoginDataParsingException: ``` # Documentation -The docs are available [here](https://edupage-api.hrabcak.eu/) +The docs are available [here](https://ivanhrabcak.github.io/edupage-api/) # I have a problem or an idea! - If you find any issue with this code, or it doesn't work please, let us know by opening an [issue](https://github.com/ivanhrabcak/edupage-api/issues/new/choose)! - Feel free to suggest any other features! Just open an [issue with the _Feature Request_ tag](https://github.com/ivanhrabcak/edupage-api/issues/new?labels=feature+request&template=feature_request.md&title=%5BFeature+request%5D+). - If you, even better, have fixed the issue, added a new feature, or made something work better, please, open a [pull request](https://github.com/ivanhrabcak/edupage-api/compare)! + +# Discord +https://discord.gg/fg6zBu9ZAn diff --git a/docs/messages.html b/docs/messages.html index 251c1c7..de28c82 100644 --- a/docs/messages.html +++ b/docs/messages.html @@ -72,7 +72,7 @@

Module edupage_api.messages

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")) @@ -134,7 +134,7 @@

Classes

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")) @@ -190,7 +190,7 @@

Methods

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")) diff --git a/docs/people.html b/docs/people.html index da25b39..f8f5cb9 100644 --- a/docs/people.html +++ b/docs/people.html @@ -120,6 +120,17 @@

Module edupage_api.people

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: @@ -517,7 +528,18 @@

Class variables

super().__init__(person_id, name, gender, in_school_since, EduAccountType.STUDENT) self.class_id = class_id - self.number_in_class = number_in_class + 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

Ancestors