Клиент для взаимодействия с Агентом ПОДД СМЭВ
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.3.tar.gz
(12.3 kB
view hashes)
Built Distribution
Close
Hashes for smev_agent_client-0.2.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a769f822e7b021dbbce173277647f1a42cf65cc9707278b9e45ea06343b7ea24 |
|
MD5 | 9c42257317e4f47f3f6f058838cebe60 |
|
BLAKE2b-256 | 230b94b0fe7c2e2abbc0438aa092dd808d81ded9f6164fc99a9bca9ab547c889 |