Krukov / amocrm_api

Python amocrm API wrapper
MIT License
104 stars 55 forks source link

IndexError: list index out of range при парсинге данных Event #77

Closed AndrejGorodnij closed 2 years ago

AndrejGorodnij commented 2 years ago

Возникает на разных свойствах, ['note'], ['link'] и т.д при переборе и выводе каждого элемента списка событий в консоль.

Traceback (most recent call last): File "/home/rusty/Client-projects/AmoCrmDB/another_wrap.py", line 137, in print(i) File "/home/rusty/Client-projects/AmoCrmDB/venv/lib/python3.10/site-packages/amocrm/v2/model.py", line 40, in repr fields = [ File "/home/rusty/Client-projects/AmoCrmDB/venv/lib/python3.10/site-packages/amocrm/v2/model.py", line 41, in "{} = {}".format(field.name, getattr(self, attr)) File "/home/rusty/Client-projects/AmoCrmDB/venv/lib/python3.10/site-packages/amocrm/v2/fields.py", line 33, in get return self.on_get_instance(instance, data) File "/home/rusty/Client-projects/AmoCrmDB/venv/lib/python3.10/site-packages/amocrm/v2/entity/events.py", line 93, in on_get_instance return value[0]["note"]["id"] IndexError: list index out of range

Traceback (most recent call last): File "/home/rusty/Client-projects/AmoCrmDB/another_wrap.py", line 133, in print(i) File "/home/rusty/Client-projects/AmoCrmDB/venv/lib/python3.10/site-packages/amocrm/v2/model.py", line 40, in repr fields = [ File "/home/rusty/Client-projects/AmoCrmDB/venv/lib/python3.10/site-packages/amocrm/v2/model.py", line 41, in "{} = {}".format(field.name, getattr(self, attr)) File "/home/rusty/Client-projects/AmoCrmDB/venv/lib/python3.10/site-packages/amocrm/v2/fields.py", line 33, in get return self.on_get_instance(instance, data) File "/home/rusty/Client-projects/AmoCrmDB/venv/lib/python3.10/site-packages/amocrm/v2/entity/events.py", line 103, in on_get_instance return value[0]["link"]["entity"] IndexError: list index out of range

AndrejGorodnij commented 2 years ago

Добавил PR для фикса