Skip to main content

Клиент для взаимодействия с Агентом ПОДД СМЭВ

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)

Uploaded Source

Built Distribution

smev_agent_client-0.2.4-py3-none-any.whl (16.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page