Клиент для взаимодействия со СМЭВ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())
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file smev_agent_client-0.5.2-py3-none-any.whl.
File metadata
- Download URL: smev_agent_client-0.5.2-py3-none-any.whl
- Upload date:
- Size: 18.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.1.0 CPython/3.9.23
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
99e98fbab1b131b6d6b2da296e979b540d1f30bce91b42caee4640597cd34c98
|
|
| MD5 |
1bedebb9a70e7237c3c2664ab67985a8
|
|
| BLAKE2b-256 |
087578d530401810f273320b20d861f9a80b9d2cfffa99da614a0b484c26dae5
|