First commit. Added part of legal entities methods.
This commit is contained in:
4
kontur_focus/__init__.py
Normal file
4
kontur_focus/__init__.py
Normal file
@@ -0,0 +1,4 @@
|
||||
from .focus import Focus
|
||||
from .government_lists import gl
|
||||
|
||||
__all__ = [Focus, gl]
|
||||
60
kontur_focus/focus.py
Normal file
60
kontur_focus/focus.py
Normal file
@@ -0,0 +1,60 @@
|
||||
import requests
|
||||
import os
|
||||
from dotenv import load_dotenv
|
||||
from kontur_focus.government_lists import gl
|
||||
|
||||
|
||||
class Focus:
|
||||
_base_url = None
|
||||
_access_key = None
|
||||
_inn = None
|
||||
_orgn = None
|
||||
|
||||
def __init__(self, inn: str, ogrn: str = None):
|
||||
load_dotenv()
|
||||
self._base_url = os.environ.get('BASE_URL')
|
||||
self._access_key = os.environ.get('ACCESS_KEY')
|
||||
self._inn = inn
|
||||
self._orgn = ogrn
|
||||
|
||||
def _r_get(self, path: str):
|
||||
full_url = f'{self._base_url}{path}'
|
||||
payload = {'key': self._access_key, 'inn': self._inn, 'ogrn': self._orgn}
|
||||
|
||||
return requests.get(url=full_url, params=payload).json()
|
||||
|
||||
def base_info(self):
|
||||
return self._r_get('/req')
|
||||
|
||||
def advanced_info(self):
|
||||
return self._r_get('/egrDetails')
|
||||
|
||||
def founders_history(self):
|
||||
return self._r_get('/foundersHistory')
|
||||
|
||||
def foreign_representatives(self):
|
||||
return self._r_get('/foreignRepresentatives')
|
||||
|
||||
def full_analytics(self):
|
||||
return self._r_get('/analytics')
|
||||
|
||||
@staticmethod
|
||||
def government_lists():
|
||||
formatted_list = [(elem.get('name'), elem.get('description')) for elem in gl]
|
||||
|
||||
return formatted_list
|
||||
|
||||
def check_if_in_lists(self, list_name: str = None):
|
||||
"""
|
||||
Check if organization is consist in Government lists
|
||||
|
||||
:param list_name: str List name
|
||||
:return: json
|
||||
"""
|
||||
if not list_name:
|
||||
return self._r_get('/analyticLists')
|
||||
else:
|
||||
data = self._r_get('/analyticLists')[0]['listsEntries']
|
||||
list_id = next(item['uid'] for item in gl if item['name'] == list_name)
|
||||
|
||||
return next(lst['isInList'] for lst in data if lst['id'] == list_id)
|
||||
112
kontur_focus/government_lists.py
Normal file
112
kontur_focus/government_lists.py
Normal file
@@ -0,0 +1,112 @@
|
||||
gl = [
|
||||
{
|
||||
'name': 'illicit_reward',
|
||||
'uid': '53a2d6b8-2ca3-41a6-b3c2-f942d58b35fd',
|
||||
'description': 'Участники закупок, привлечённые к административной ответственности по ст. 19.28 КоАП РФ'
|
||||
},
|
||||
{
|
||||
'name': 'banks',
|
||||
'uid': '7c1c310a-9c26-4e08-80f5-8b7611f28460',
|
||||
'description': 'Перечень кредитных организаций'
|
||||
},
|
||||
{
|
||||
'name': 'insurance_business',
|
||||
'uid': 'c18dd28d-0028-4bad-b73c-c15de023d843',
|
||||
'description': 'Страховые компании'
|
||||
},
|
||||
{
|
||||
'name': 'foreign_agents',
|
||||
'uid': 'fcfc856d-89f8-408b-afef-56750cb90fed',
|
||||
'description': 'Иностранные агенты'
|
||||
},
|
||||
{
|
||||
'name': 'golden_share',
|
||||
'uid': 'd103af01-bf6d-470a-9eea-1536b840c287',
|
||||
'description': 'Золотая акция государства'
|
||||
},
|
||||
{
|
||||
'name': 'msp_support',
|
||||
'uid': 'f0efa959-854f-4617-b24a-0f5dc7d8e28a',
|
||||
'description': 'Инфраструктура поддержки МСП'
|
||||
},
|
||||
{
|
||||
'name': 'construction_sro_excluded',
|
||||
'uid': 'c318de8e-95b0-4b8e-bb13-1d65e43aa471',
|
||||
'description': 'Исключенные из реестра СРО в области строительства'
|
||||
},
|
||||
{
|
||||
'name': 'design_sro_excluded',
|
||||
'uid': 'fa890998-6c87-40a5-9aee-ef547056a07f',
|
||||
'description': 'Исключённые из СРО в области изысканий и (или) проектирования'
|
||||
},
|
||||
{
|
||||
'name': 'major_taxpayers',
|
||||
'uid': '91f7e831-cb59-47ae-b86a-c662ada337da',
|
||||
'description': 'Крупнейшие налогоплательщики'
|
||||
},
|
||||
{
|
||||
'name': 'nko_public',
|
||||
'uid': '937e8c0c-c7da-42ff-b8ca-2a526a33e48b',
|
||||
'description': 'НКО - исполнители общественно полезных услуг Минюста России'
|
||||
},
|
||||
{
|
||||
'name': 'pyramid_scheme',
|
||||
'uid': 'cd5b5b63-9cae-4ac5-b74f-d58b8066e696',
|
||||
'description': 'Признаки финансовой пирамиды'
|
||||
},
|
||||
{
|
||||
'name': 'illegal_lender',
|
||||
'uid': '2227c3f1-934d-4d1f-8d08-a542518bfad9',
|
||||
'description': 'Признаки нелегального кредитора'
|
||||
},
|
||||
{
|
||||
'name': 'illegal_brokers',
|
||||
'uid': 'b22b4c23-e02d-4819-8a7a-f32ca4185bc2',
|
||||
'description': 'Признаки нелегального профессионального участника рынка ценных бумаг'
|
||||
},
|
||||
{
|
||||
'name': 'timber_transactions',
|
||||
'uid': 'bead481d-d201-4283-be29-5011621925b1',
|
||||
'description': 'Продавцы из реестра Сделки с древесиной'
|
||||
},
|
||||
{
|
||||
'name': 'tour_operators',
|
||||
'uid': 'da30f33a-7034-4a4a-8869-4a4e523ec85d',
|
||||
'description': 'Реестр туроператоров'
|
||||
},
|
||||
{
|
||||
'name': 'brokers',
|
||||
'uid': '04cec8e4-b375-4bbd-b0ff-6ef6d201da93',
|
||||
'description': 'Список брокеров'
|
||||
},
|
||||
{
|
||||
'name': 'strategic_enterprises',
|
||||
'uid': 'd764d2a2-b33b-446f-b60e-be517698864d',
|
||||
'description': 'Стратегические предприятия и стратегические АО'
|
||||
},
|
||||
{
|
||||
'name': 'facilitators',
|
||||
'uid': '202f2c7d-3cb2-41ae-aa14-817824b81a76',
|
||||
'description': 'Участники информационного ресурса фасилити-операторов'
|
||||
},
|
||||
{
|
||||
'name': 'apk_charter',
|
||||
'uid': '3a255260-d236-476d-939f-6b1d947c110f',
|
||||
'description': 'Участники Хартии АПК'
|
||||
},
|
||||
{
|
||||
'name': 'ats_charter',
|
||||
'uid': 'b15bc70b-611e-45d0-b836-9fdb123cb9c2',
|
||||
'description': 'Участники Хартии АТС'
|
||||
},
|
||||
{
|
||||
'name': 'design_sro_members',
|
||||
'uid': '83b314dd-6ba1-4e66-a9bb-91affecd336b',
|
||||
'description': 'Члены СРО в области изысканий и (или) проектирования'
|
||||
},
|
||||
{
|
||||
'name': 'construction_sro_members',
|
||||
'uid': 'a9278dcd-1999-4c0d-b467-dac85b09e337',
|
||||
'description': 'Члены СРО в области строительства'
|
||||
},
|
||||
]
|
||||
Reference in New Issue
Block a user