Fixed search_global_company_profiles_id method

New response and fixed query parameter
This commit is contained in:
2025-10-03 19:04:30 +03:00
parent 1be43c827f
commit 4cc7d0ac7b
2 changed files with 16 additions and 7 deletions

View File

@@ -67,24 +67,33 @@ class FocusCompliance(Request):
return fal_data
def search_global_company_profiles_id(self) -> list:
def search_global_company_profiles_id(self, company_name: str = None) -> list:
"""Поиск сводной информации по санкционным профилям ЮЛ
:param company_name: Наименование компании
:type company_name: str
:return: Список идентификаторов профилей
:rtype: list
"""
if self.inn:
query = self.inn
elif company_name:
query = company_name
else:
return {'success': False, 'result': 'Не указан ИНН или наименование контрагента'}
try:
response = self.get(f'{self._focus_base_url}/companies/profiles/search', query=self.inn)
response = self.get(f'{self._focus_base_url}/companies/profiles/search', query=query)
profiles = response['legalEntityProfiles']
if not profiles:
return profiles
return {'success': True, 'result': profiles}
elif len(profiles) > 1:
return [profile['id'] for profile in profiles]
return {'success': True, 'result': [profile['id'] for profile in profiles]}
else:
return [profiles[0]['id']]
return {'success': True, 'result': [profiles[0]['id']]}
except KeyError:
return None
return {'success': False, 'result': 'Key Error'}
def legal_entity_profile_report(self, profile_id_list: list, path: str = None) -> dict:
"""Получение печатного отчета по профилю ЮЛ

View File

@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
setup(
name="kontur_focus",
version="2025.9.0",
version="2025.10.0",
author="Ilya Sapunov",
author_email="sapunov@selectel.ru",
description="Библиотека-обертка для взаимодействия с REST API Контур.Фокус и Фокус.Комплаенс",