Skip to content

[Bug] lunches_data is an empty list at times #83

Description

@reinum

Describe the bug
The lunches_data in the edupage api.lunches returns [] at times and is not handled at all

Your code

...
lunch = edupage.get_lunches(date)
...

Error message

Traceback (most recent call last):
  File "/home/vertexxdev/Documents/Hobby Shit/lunchOrderer/dataGather.py", line 27, in <module>
    ordered_lunch = edupage.get_ordered_lunch(date)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vertexxdev/Documents/Hobby Shit/lunchOrderer/venv/lib/python3.12/site-packages/edupage_api/__init__.py", line 188, in get_ordered_lunch
    return Lunches(self).get_ordered_lunch(date)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vertexxdev/Documents/Hobby Shit/lunchOrderer/venv/lib/python3.12/site-packages/edupage_api/module.py", line 100, in __impl
    return method(self, *method_args, **method_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vertexxdev/Documents/Hobby Shit/lunchOrderer/venv/lib/python3.12/site-packages/edupage_api/lunches.py", line 209, in get_ordered_lunch
    lunches_data = lunch_data.get(self.edupage.subdomain)
                   ^^^^^^^^^^^^^^
AttributeError: 'list' object has no attribute 'get'

Expected behavior
Return None or empty list.

Version

  • Edupage API version: 0.11.0
  • Python version: 3.12.6

Activity

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

Metadata

Metadata

Assignees

No one assigned

    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