Changed docs and updated methods in Focus

This commit is contained in:
2025-03-18 15:12:57 +03:00
parent fa273790b4
commit 2c4438ee3b
3 changed files with 32 additions and 11 deletions

View File

@@ -29,10 +29,17 @@
Основные методы
---------------
.. autofunction:: kontur_focus.FocusCompliance.company_is_foreign_agent()
Юридические лица
----------------
.. autofunction:: kontur_focus.FocusCompliance.person_is_foreign_agent()
.. autofunction:: kontur_focus.FocusCompliance.company_is_foreign_agent()
.. autofunction:: kontur_focus.FocusCompliance.search_global_company_profiles_id()
.. autofunction:: kontur_focus.FocusCompliance.legal_entity_profile_report(profile_id_list, path)
Физические лица
---------------
.. autofunction:: kontur_focus.FocusCompliance.person_is_foreign_agent()

View File

@@ -35,11 +35,16 @@
focus.base_info()
Юридические лица
----------------
.. autofunction:: kontur_focus.Focus.base_info()
.. autofunction:: kontur_focus.Focus.advanced_info()
.. autofunction:: kontur_focus.Focus.excerpt(path=None)
.. autofunction:: kontur_focus.Focus.excerpt(path)
.. autofunction:: kontur_focus.Focus.express_report(pdf, path)
.. autofunction:: kontur_focus.Focus.founders_history()

View File

@@ -32,7 +32,7 @@ class Focus(Request):
"""
return self.get('/egrDetails')
def excerpt(self, path: str = None):
def excerpt(self, path: str = None) -> dict:
"""Выписка из ЕГРЮЛ/ЕГРИП
:param path: Путь выгрузки файла. Если не указан, выгружается в текущий каталог.
@@ -53,11 +53,20 @@ class Focus(Request):
with open(file_path, mode='wb') as file:
file.write(response.content)
return f'File {file_path} saved'
except Exception:
return 'Saving error!'
return {'success': True, 'filename': filename, 'path': file_path}
except Exception as e:
return {'success': False, 'message': e}
def express_report(self, pdf: bool = True, path: str = None):
def express_report(self, pdf: bool = True, path: str = None) -> dict:
"""Экспресс-отчет по контрагенту
:param pdf: Выгрузить PDF файл, по-умолчанию True
:type pdf: bool, optional
:param path: Путь выгрузки файла. Если не указан, выгружается в текущий каталог.
:type path: str, optional
:return: _description_
:rtype: _type_
"""
response = self.get('/briefReport', pdf=pdf)
current_datetime = datetime.now().strftime('%d-%m-%Y_%H-%M')
filename = f'Экспресс-отчет_{self.inn}_{current_datetime}.pdf'
@@ -72,9 +81,9 @@ class Focus(Request):
with open(file_path, mode='wb') as file:
file.write(response.content)
return f'File {file_path} saved'
except Exception:
return 'Saving error!'
return {'success': True, 'filename': filename, 'path': file_path}
except Exception as e:
return {'success': False, 'message': e}
else:
return response