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

@@ -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