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 details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

Details for the file smev-agent-client-0.2.4.tar.gz.

File metadata

  • Download URL: smev-agent-client-0.2.4.tar.gz
  • Upload date:
  • Size: 12.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.9.6 readme-renderer/42.0 requests/2.31.0 requests-toolbelt/1.0.0 urllib3/2.0.5 tqdm/4.66.4 importlib-metadata/6.8.0 keyring/24.2.0 rfc3986/2.0.0 colorama/0.4.6 CPython/3.9.7

File hashes

Hashes for smev-agent-client-0.2.4.tar.gz
Algorithm Hash digest
SHA256 9a79e852b7e7696112d68cc80d3e38f938b88c18474c9672efd45d1d2e2678f3
MD5 0280852d127a4488b06bc5a62ffcd04b
BLAKE2b-256 3e33381924703b64d18b852cbd119c80f2a95b0f30a86d450603b884f3b8c15c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: smev_agent_client-0.2.4-py3-none-any.whl
  • Upload date:
  • Size: 16.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.9.6 readme-renderer/42.0 requests/2.31.0 requests-toolbelt/1.0.0 urllib3/2.0.5 tqdm/4.66.4 importlib-metadata/6.8.0 keyring/24.2.0 rfc3986/2.0.0 colorama/0.4.6 CPython/3.9.7

File hashes

Hashes for smev_agent_client-0.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 3180b1dc51375138c624879524590c06601f47d3590c8f64882e4bab585ef6f2
MD5 fba4292bf24598573bf5e74511efd22f
BLAKE2b-256 96bbffa24ca0a19a076a027d5d46b9551d1afc9fa79657524568f141de12e216

See more details on using hashes here.

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