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 Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

smev_agent_client-0.5.2-py3-none-any.whl (18.3 kB view details)

Uploaded Python 3

File details

Details for the file smev_agent_client-0.5.2-py3-none-any.whl.

File metadata

File hashes

Hashes for smev_agent_client-0.5.2-py3-none-any.whl
Algorithm Hash digest
SHA256 99e98fbab1b131b6d6b2da296e979b540d1f30bce91b42caee4640597cd34c98
MD5 1bedebb9a70e7237c3c2664ab67985a8
BLAKE2b-256 087578d530401810f273320b20d861f9a80b9d2cfffa99da614a0b484c26dae5

See more details on using hashes here.

Supported by

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