Skip to content

[Bug] Login does not work due to change in website #101

Description

@BerengarWLehr

Describe the bug
I try to login as described in the example

Your code

from edupage_api import Edupage
from edupage_api.exceptions import BadCredentialsException, CaptchaException

edupage = Edupage()
USER = "###"
PASSWORD = "###"
SCHOOL = "###"

try:
    second_factor = edupage.login(USER, PASSWORD, SCHOOL)
    if second_factor is not None:
        user = input("Hit enter when 2FA is done...")
        second_factor.finish()
except BadCredentialsException:
    print("Wrong username or password!")
except CaptchaException:
    print("Captcha required!")

Error message

Traceback (most recent call last):
  File "/home/ber/Projekte/Edupage/main.py", line 10, in <module>
    second_factor = edupage.login(USER, PASSWORD, SCHOOL)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ber/Projekte/Edupage/.venv/lib/python3.12/site-packages/edupage_api/__init__.py", line 69, in login
    return Login(self).login(username, password, subdomain)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/ber/Projekte/Edupage/.venv/lib/python3.12/site-packages/edupage_api/login.py", line 209, in login
    csrf_token = data.split('csrfauth" value="')[1].split('"')[0]
                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^
IndexError: list index out of range```

Expected behavior
Login to proceed

Version

  • Edupage API version: 0.12.3
  • Python version: 3.12.3

I assume the error is due to a change of edupage. In login.py:208 html is searched for csrfauth" value=" which looks to me like a form element. But in my version of Edupage the form is build dynamically. Important information are stored in javascript variable

var elem = $j('#jwc897fed5_3c167b31').get(0);
var props = {"username":"##MY USERNAME##","deviceNames":["##MY DEVICE##"],"email":"##MY EMAIL##","edupage":"##MY SCHOOL/SUBDOMAIN##","requestid":"## 40byte hex##","gu":null,"au":"","storedUsers":[]};

Activity

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions