Skip to content

Return None from get_meals() when the school doesn't use meals - #130

Merged
ivanhrabcak merged 2 commits into
EdupageAPI:masterfrom
MilanPala:fix-meals-without-module
Oct 11, 2026
Merged

ivanhrabcak merged 2 commits into
EdupageAPI:masterfrom
MilanPala:fix-meals-without-module

Conversation

@MilanPala

Copy link
Copy Markdown
Contributor

Problem

For a school that doesn't use EduPage's meal module, get_meals() fails with:

response.split("edupageData: ")[1].split(",\r\n")[0]
IndexError: list index out of range

The /menu/ page of such a school has no edupageData: at all.

Fix

Return None when the page has no edupageData:. That matches what get_meals() already returns for empty menu data (#121).

Tests

New case in tests/test_lunches.py for a page without edupageData. It fails on master, and the suite passes. Also checked against a real school without meals: get_meals() returns None.

Co-Authored-By: Claude Code

Milan Pála and others added 2 commits October 11, 2026 13:32
The menu page of a school without EduPage's meal module has no
edupageData, so get_meals() failed with IndexError.

Co-Authored-By: Claude Code
@ivanhrabcak

Copy link
Copy Markdown
Member

Thank you for your contribution!

@ivanhrabcak
ivanhrabcak merged commit 0b8229b into EdupageAPI:master Oct 11, 2026
2 checks passed
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.

2 participants