Module edupage_api.parent

Classes

class Parent (edupage: EdupageModule)
Expand source code
class Parent(Module):
    @ModuleHelper.logged_in
    @ModuleHelper.is_parent
    def switch_to_child(self, child: Union[EduAccount, int]):
        params = {"studentid": child.person_id if type(child) == EduAccount else child}

        url = f"https://{self.edupage.subdomain}.edupage.org/login/switchchild"
        response = self.edupage.session.get(url, params=params)

        if response.text != "OK":
            raise InvalidChildException(
                f"{response.text}: Invalid child selected! (not your child?)"
            )

    @ModuleHelper.logged_in
    @ModuleHelper.is_parent
    def switch_to_parent(self):
        # variable name is from edupage's code :/
        rid = f"edupage;{self.edupage.subdomain};{self.edupage.username}"

        params = {"rid": rid}

        url = f"https://{self.edupage.subdomain}.edupage.org/login/edupageChange"
        response = self.edupage.session.get(url, params=params)

        if "EdupageLoginFailed" in response.url:
            raise UnknownServerError()

Ancestors

Methods

def switch_to_child(self,
child: EduAccount | int)
Expand source code
@ModuleHelper.logged_in
@ModuleHelper.is_parent
def switch_to_child(self, child: Union[EduAccount, int]):
    params = {"studentid": child.person_id if type(child) == EduAccount else child}

    url = f"https://{self.edupage.subdomain}.edupage.org/login/switchchild"
    response = self.edupage.session.get(url, params=params)

    if response.text != "OK":
        raise InvalidChildException(
            f"{response.text}: Invalid child selected! (not your child?)"
        )
def switch_to_parent(self)
Expand source code
@ModuleHelper.logged_in
@ModuleHelper.is_parent
def switch_to_parent(self):
    # variable name is from edupage's code :/
    rid = f"edupage;{self.edupage.subdomain};{self.edupage.username}"

    params = {"rid": rid}

    url = f"https://{self.edupage.subdomain}.edupage.org/login/edupageChange"
    response = self.edupage.session.get(url, params=params)

    if "EdupageLoginFailed" in response.url:
        raise UnknownServerError()