Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f657ca77a4 | |||
| 6982393d03 | |||
| 227905dc04 | |||
| e03aed78f0 |
+22
-14
@@ -33,7 +33,7 @@ class Focus(Request):
|
||||
return self.get('/egrDetails')
|
||||
|
||||
def excerpt(self, path: str = None) -> dict:
|
||||
"""Выписка из ЕГРЮЛ/ЕГРИП
|
||||
"""Выписка из ЕГРЮЛ/ЕГРИП (только для РФ)
|
||||
|
||||
:param path: Путь выгрузки файла. Если не указан, выгружается в текущий каталог.
|
||||
:type path: str, необязательный
|
||||
@@ -41,21 +41,25 @@ class Focus(Request):
|
||||
:rtype: str
|
||||
"""
|
||||
response = self.get('/excerpt')
|
||||
current_datetime = datetime.now().strftime('%d-%m-%Y_%H-%M')
|
||||
filename = f'Выписка_{self.inn}_{current_datetime}.pdf'
|
||||
|
||||
if response.status_code != 404:
|
||||
current_datetime = datetime.now().strftime('%d-%m-%Y_%H-%M')
|
||||
filename = f'Выписка_{self.inn}_{current_datetime}.pdf'
|
||||
|
||||
if not path:
|
||||
file_path = os.path.join(self._basedir, filename)
|
||||
if not path:
|
||||
file_path = os.path.join(self._basedir, filename)
|
||||
else:
|
||||
file_path = os.path.join(path, filename)
|
||||
|
||||
try:
|
||||
with open(file_path, mode='wb') as file:
|
||||
file.write(response.content)
|
||||
|
||||
return {'success': True, 'filename': filename, 'path': file_path}
|
||||
except Exception as e:
|
||||
return {'success': False, 'message': e}
|
||||
else:
|
||||
file_path = os.path.join(path, filename)
|
||||
|
||||
try:
|
||||
with open(file_path, mode='wb') as file:
|
||||
file.write(response.content)
|
||||
|
||||
return {'success': True, 'filename': filename, 'path': file_path}
|
||||
except Exception as e:
|
||||
return {'success': False, 'message': e}
|
||||
return {'success': False, 'message': 'Not found'}
|
||||
|
||||
def express_report(self, pdf: bool = True, path: str = None) -> dict:
|
||||
"""Экспресс-отчет по контрагенту
|
||||
@@ -145,3 +149,7 @@ class Focus(Request):
|
||||
foreign_agents_list = next(lst for lst in self.government_lists() if lst['id'] == 'fcfc856d-89f8-408b-afef-56750cb90fed')
|
||||
|
||||
return foreign_agents_list['isInList']
|
||||
|
||||
def kz_company_details(self):
|
||||
response = self.get('/kz/companyDetails', bin=self.inn)
|
||||
return response[0] if response else None
|
||||
|
||||
@@ -229,7 +229,9 @@ class FocusCompliance(Request):
|
||||
file_type='docx',
|
||||
path=path
|
||||
)
|
||||
|
||||
if not result['success']:
|
||||
return {'success': False, 'result': result['message']}
|
||||
|
||||
return {'success': True, 'file': result}
|
||||
except AttributeError:
|
||||
return {'success': False, 'result': 'Организация не найдена'}
|
||||
|
||||
+2
-2
@@ -36,8 +36,8 @@ class Request:
|
||||
try:
|
||||
response = requests.get(url=full_url, params=payload)
|
||||
|
||||
if response.headers['Content-Type'] == 'application/json' or \
|
||||
response.headers['Content-Type'] == 'application/json; charset=utf-8':
|
||||
if ('Content-Type' in response.headers and response.headers['Content-Type'] == 'application/json') or \
|
||||
('Content-Type' in response.headers and response.headers['Content-Type'] == 'application/json; charset=utf-8'):
|
||||
return response.json()
|
||||
else:
|
||||
return response
|
||||
|
||||
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
|
||||
|
||||
setup(
|
||||
name="kontur_focus",
|
||||
version="2026.1.0",
|
||||
version="2026.4.3",
|
||||
author="Ilya Sapunov",
|
||||
author_email="me@slrover.ru",
|
||||
description="Библиотека-обертка для взаимодействия с REST API Контур.Фокус и Фокус.Комплаенс",
|
||||
|
||||
Reference in New Issue
Block a user