EdupageAPI / edupage-api

A python library for accessing your Edupage account
https://edupageapi.github.io/edupage-api/
GNU General Public License v3.0
67 stars 13 forks source link

[Bug] Error with getting the missing teachers #72

Closed aktienmakler closed 4 months ago

aktienmakler commented 1 year ago

Describe the bug When using the substitution-cli.py there is always an error on getting the missing teachers.

Your code

python3 substitution-cli.py --format csv  "FOO" "BAR" "BAZ"

Error message

  File "/usr/local/lib/python3.9/dist-packages/edupage_api/substitution.py", line 67, in get_missing_teachers
    _title, missing_teachers = missing_teachers_string.split(": ")

Expected behavior Get a list of missing teachers and the timetable for the next day.

Version

Workaround To avoid the error (and skip missing teachers), edit edupage_api/substitution.py and return early.

    def get_missing_teachers(self, date: date) -> Optional[list[EduTeacher]]:
        html = self.__get_substitution_data(date)
        missing_teachers_string = (html.split("<div class=\"header\"><span class=\"print-font-resizable\">")[1].split("</span>")[0])

        if not missing_teachers_string:
            return None

        return []

line 121

action, lesson_n, title = change.split("</span>",3)[:-1]
ivanhrabcak commented 11 months ago

I've added your suggestion (the maxsplit=3 argument). You can update to 0.10.6:

pip install --upgrade edupage_api

Is the issue fixed?

aktienmakler commented 11 months ago

Not really. I think we face 2 different problems.

The first is resolved by "return []" (return early) and ignoring everything. (line 69)

The second is the splitting of the timetable (line 121). This is fixed.

As I'm not sure, how the "missing_teachers_string" is supposed to look like (and my python is rather poor), I can't add a fix better than returning early and skipping the content.

ivanhrabcak commented 11 months ago

Would it be possible for us to call on my discord server? We can debug the issue together.

BelKed commented 7 months ago

Hi @aktienmakler! There has been no recent activity on this issue. The substitution code has been rewritten since the issue was opened. Is the problem still there or can I close this issue?

BelKed commented 4 months ago

Closed as there has been no recent activity. Feel free to let us know if the problem persists :)