diff --git a/kontur_focus/focus_compliance.py b/kontur_focus/focus_compliance.py index 98d94a2..6378868 100644 --- a/kontur_focus/focus_compliance.py +++ b/kontur_focus/focus_compliance.py @@ -148,7 +148,25 @@ class FocusCompliance(Request): except KeyError: return None - def get_foreign_agents_list(self): # Не работает, если нет подключенной лицензии + # Иноагенты + def get_foreign_agents_list(self, fa_type: str = None) -> list: # Не работает, если нет подключенной лицензии + """Получение списка иноагентов + + :param fa_type: Тип иноагента (i - физ. лица, l - юридические лица), если не указано, выгружаются все типы, defaults to None + :type fa_type: str, optional + :return: Список данных по иноагентам + :rtype: list + """ response = self.get(path=f'{self._focus_base_url}/foreign-agents') + result = None - return response + if fa_type == 'i': + individuals = response['individuals'] + result = individuals + elif fa_type == 'l': + legal_entities = response['legalEntities'] + result = legal_entities + else: + result = [response] + + return result diff --git a/setup.py b/setup.py index 8026ba0..3d99f2c 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ from setuptools import setup, find_packages setup( name="kontur_focus", - version="0.2.7", + version="0.2.8", author="Ilya Sapunov", author_email="sapunov@selectel.ru", description="Библиотека-обертка для взаимодействия с REST API Контур.Фокус и Фокус.Комплаенс",