Closed ghost closed 3 years ago
короче, проблема была в том, что у нас ни у одного предмета не поставили кабинет (кроме физры, у нас все в одном и том же кабинете), а у либы в схеме поле room имелось, поэтому и жаловалась, что его нету. путём обезянего патчинга убрал его из схемы, теперь все работает
спасибо
Описание проблемы
код:
data['date']
это пропарсенная через dateparser строка, преобразованная вdatetime.datetime
Каков ожидаемый результат?
Каков реальный результат?
Traceback (most recent call last): File "/home/ubuntu/snvmk-bot-py/.venv/lib/python3.9/site-packages/aiogram/dispatcher/dispatcher.py", line 417, in _process_polling_updates for responses in itertools.chain.from_iterable(await self.process_updates(updates, fast)): File "/home/ubuntu/snvmk-bot-py/.venv/lib/python3.9/site-packages/aiogram/dispatcher/dispatcher.py", line 238, in process_updates return await asyncio.gather(tasks) File "/home/ubuntu/snvmk-bot-py/.venv/lib/python3.9/site-packages/aiogram/dispatcher/handler.py", line 116, in notify response = await handler_obj.handler(args, *partial_data) File "/home/ubuntu/snvmk-bot-py/.venv/lib/python3.9/site-packages/aiogram/dispatcher/dispatcher.py", line 259, in process_update return await self.message_handlers.notify(update.message) File "/home/ubuntu/snvmk-bot-py/.venv/lib/python3.9/site-packages/aiogram/dispatcher/handler.py", line 116, in notify response = await handler_obj.handler(args, **partial_data) File "/home/ubuntu/snvmk-bot-py/main.py", line 68, in process_lesson diary = await ns.diary( File "/home/ubuntu/snvmk-bot-py/.venv/lib/python3.9/site-packages/netschoolapi/netschoolapi.py", line 172, in diary return data.diary(diary_schema.load(response.json())) File "/home/ubuntu/snvmk-bot-py/.venv/lib/python3.9/site-packages/marshmallow/schema.py", line 719, in load return self._do_load( File "/home/ubuntu/snvmk-bot-py/.venv/lib/python3.9/site-packages/marshmallow/schema.py", line 901, in _do_load raise exc marshmallow.exceptions.ValidationError: {'weekDays': {0: {'lessons': {0: {'room': ['Field may not be null.']}, 1: {'room': ['Field may not be null.']}, 2: {'room': ['Field may not be null.']}, 3: {'room': ['Field may not be null.']}, 4: {'room': ['Field may not be null.']}, 5: {'room': ['Field may not be null.']}}}, 1: {'lessons': {0: {'room': ['Field may not be null.']}, 1: {'room': ['Field may not be null.']}, 2: {'room': ['Field may not be null.']}, 3: {'room': ['Field may not be null.']}, 4: {'room': ['Field may not be null.']}, 5: {'room': ['Field may not be null.']}}}, 2: {'lessons': {0: {'room': ['Field may not be null.']}, 1: {'room': ['Field may not be null.']}, 2: {'room': ['Field may not be null.']}, 3: {'room': ['Field may not be null.']}, 4: {'room': ['Field may not be null.']}, 5: {'room': ['Field may not be null.']}}}, 3: {'lessons': {0: {'room': ['Field may not be null.']}, 1: {'room': ['Field may not be null.']}, 2: {'room': ['Field may not be null.']}, 3: {'room': ['Field may not be null.']}, 4: {'room': ['Field may not be null.']}}}}}
Дополнительные детали / скриншот
Используеться в aiogram телеграм боте