edupage-api icon indicating copy to clipboard operation
edupage-api copied to clipboard

[Bug] lunches_data is an empty list at times

Open reinum opened this issue 1 year ago • 1 comments

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

reinum avatar Nov 26 '24 10:11 reinum

can theoretically do a PR fixing this issue later myself but dont know

reinum avatar Nov 26 '24 10:11 reinum