Skip to content

Add methods for listing a parent's children and school accounts, and switching schools - #131

Open
ivanhrabcak wants to merge 4 commits into
masterfrom
feature/list-children
Open

ivanhrabcak wants to merge 4 commits into
masterfrom
feature/list-children

Conversation

@ivanhrabcak

Copy link
Copy Markdown
Member

A parent account can have children in several schools. There is currently no way to list the children, so the only way to get a child's id for switch_to_child() was to read edupage.data["parentStudentids"]. There was also no way to see or switch between a children in different schools.

There are new methods that fix this problem:

from edupage_api import Edupage
edupage = Edupage()
edupage.login(username, password, "school-b")

schools = edupage.get_school_accounts()
# schools will look something like this:
# [
#     SchoolAccount(
#         subdomain='school-a', 
#         is_current=False, 
#         children=[SchoolChild(person_id=1, name='Child 1')]
#     ),
#     SchoolAccount(
#         subdomain='school-b', 
#         is_current=True, 
#         children=[SchoolChild(person_id=12345, name='Child 2'), SchoolChild(person_id=25, name='Child 3')]
#     ),
# ]

# to go through each child, we can do this:
for school in edupage.get_school_accounts():
    edupage.switch_to_school(school)
    for child in edupage.get_children():
        edupage.switch_to_child(child)
        print(edupage.get_my_timetable(date.today()))

switch_to_child() only works inside the school you're currently switched to.

@ivanhrabcak ivanhrabcak self-assigned this Oct 11, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant