Updated docs, updated modules, removed old methods
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
import requests
|
||||
import os
|
||||
from dotenv import load_dotenv
|
||||
from kontur_focus.government_lists import gl
|
||||
from kontur_focus.req import Request
|
||||
|
||||
|
||||
@@ -73,26 +71,22 @@ class Focus(Request):
|
||||
"""
|
||||
return self.get('/foreignRepresentatives')
|
||||
|
||||
def full_analytics(self): # DEPRECATED
|
||||
return self.get('/analytics')
|
||||
def government_lists(self):
|
||||
"""Вхождение организации в государственные реестры
|
||||
|
||||
@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):
|
||||
:return: Список реестров
|
||||
:rtype: _type_
|
||||
"""
|
||||
Check if organization is consist in Government lists
|
||||
response = self.get('/analyticLists')
|
||||
|
||||
return response['listsEntries']
|
||||
|
||||
def is_foreign_agent(self):
|
||||
"""Проверка наличия организации в Едином реестре иностранных агентов
|
||||
|
||||
:param list_name: str List name
|
||||
:return: json
|
||||
:return: Результат проверки
|
||||
:rtype: bool
|
||||
"""
|
||||
if not list_name:
|
||||
return self.get('/analyticLists')
|
||||
else:
|
||||
data = self.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)
|
||||
foreign_agents_list = next(lst for lst in self.government_lists() if lst['id'] == 'fcfc856d-89f8-408b-afef-56750cb90fed')
|
||||
|
||||
return foreign_agents_list['isInList']
|
||||
|
||||
Reference in New Issue
Block a user