Клиент для взаимодействия с Агентом ПОДД СМЭВ
Project description
Клиент для взаимодействия со СМЭВ3 посредством Адаптера
Подключение
settings:
INSTALLED_APPS = [
'smev_agent_client',
]
apps:
from django.apps import AppConfig as AppConfigBase
class AppConfig(AppConfigBase):
name = __package__
def __setup_agent_client(self):
import smev_agent_client
smev_agent_client.set_config(
smev_agent_client.configuration.Config(
agent_url='http://localhost:8090',
system_mnemonics='MNSV03',
timeout=1,
request_retries=1,
)
)
def ready(self):
super().ready()
self.__setup_agent_client()
Эмуляция
Заменить используемый интерфейс на эмулирующий запросы:
smev_agent_client.set_config(
...,
smev_agent_client.configuration.Config(
interface=(
'smev_agent_client.contrib.my_edu.interfaces.rest'
'.OpenAPIInterfaceEmulation'
)
)
)
Запуск тестов
$ tox
API
Передача сообщения
from smev_agent_client.adapters import adapter
from smev_agent_client.interfaces import OpenAPIRequest
class Request(OpenAPIRequest):
def get_url(self):
return 'http://localhost:8090/MNSV03/myedu/api/edu-upload/v1/multipart/csv'
def get_method(self):
return 'post'
def get_files(self) -> List[str]:
return [
Path('files/myedu_schools.csv').as_posix()
]
result = adapter.send(Request())
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
smev-agent-client-0.2.4.tar.gz
(12.3 kB
view hashes)
Built Distribution
Close
Hashes for smev_agent_client-0.2.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3180b1dc51375138c624879524590c06601f47d3590c8f64882e4bab585ef6f2 |
|
MD5 | fba4292bf24598573bf5e74511efd22f |
|
BLAKE2b-256 | 96bbffa24ca0a19a076a027d5d46b9551d1afc9fa79657524568f141de12e216 |