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.4.0.tar.gz (12.4 kB view details)

Uploaded Source

Built Distribution

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

smev_agent_client-0.4.0-py3-none-any.whl (16.5 kB view details)

Uploaded Python 3

File details

Details for the file smev_agent_client-0.4.0.tar.gz.

File metadata

  • Download URL: smev_agent_client-0.4.0.tar.gz
  • Upload date:
  • Size: 12.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.23

File hashes

Hashes for smev_agent_client-0.4.0.tar.gz
Algorithm Hash digest
SHA256 2fae356ee22866253b0e0e4fa5554c8d61c65166acfc94fb888595b0668600a5
MD5 d4818d9dbf759399fd206d11fc290c18
BLAKE2b-256 e8725a6e2f3fd0e6cf5d53b2ab8e81637ffcc77b61162e23d9baeb77d542444c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for smev_agent_client-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7c6a49caf6ef483d6e417348539a3cf9df55c685e9da11ec2834719465d5b979
MD5 b7061ee3ec55c653a785a33d3e6a1d7f
BLAKE2b-256 56e7405dadb9c094774b5126fb2b951dc0226a0e1c5aee04c9db709feba232a3

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