Name | uploader-client JSON |
Version |
0.2.2
JSON |
| download |
home_page | |
Summary | Клиент для взаимодействия с Загрузчиком данных в витрину |
upload_time | 2024-03-04 07:32:41 |
maintainer | |
docs_url | None |
author | BARS Group |
requires_python | |
license | MIT |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# Клиент для взаимодействия с РВД посредством Адаптера
## Подключение
settings:
INSTALLED_APPS = [
'uploader_client',
]
apps:
from django.apps import AppConfig as AppConfigBase
class AppConfig(AppConfigBase):
name = __package__
def __setup_uploader_client(self):
import uploader_client
uploader_client.set_config(
uploader_client.configuration.Config(
agent_url='http://localhost:8090',
system_mnemonics='MNSV03',
timeout=1,
request_retries=1,
)
)
def ready(self):
super().ready()
self.__setup_uploader_client()
## Использование Proxy API для отправки запросов в РВД
Заменить используемый интерфейс на ProxyAPIInterface и добавить необходимые параметры в конфигурации:
uploader_client.set_config(
...,
RegionalDataMartUploaderConfig(
interface='uploader_client.contrib.rdm.interfaces.rest.ProxyAPIInterface',
cache=<cache>,
url=<url>,
datamart_name=<datamart_name>,
organization_ogrn=<organization_ogrn>,
installation_name=<installation_name>,
installation_id=<installation_id>,
username=<username>,
password=<username>,
)
)
где
- cache - кеш django для хранения токена доступа (например, `caches[DEFAULT_CACHE_ALIAS]`);
- url - URL до хоста Datamart Studio;
- datamart_name - мнемоника Витрины;
- organization_ogrn - ОГРН организации, в рамках которой развёрнута Витрина;
- installation_name - имя инсталляции в целевой Витрине;
- installation_id - идентификатор инсталляции;
- username - имя пользователя IAM;
- password - пароль пользователя IAM.
## Эмуляция
Заменить используемый интерфейс на эмулирующий запросы:
uploader_client.set_config(
...,
uploader_client.configuration.Config(
interface=(
'uploader_client.contrib.rdm.interfaces.rest'
'.OpenAPIInterfaceEmulation'
)
)
)
## Запуск тестов
$ tox
## API
### Передача сообщения
from uploader_client.adapters import adapter
from uploader_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())
Raw data
{
"_id": null,
"home_page": "",
"name": "uploader-client",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "",
"author": "BARS Group",
"author_email": "education_dev@bars-open.ru",
"download_url": "https://files.pythonhosted.org/packages/f8/9e/2b529e4e1b8901c7d75ed9ceedc9872851d4c1c4c6883b8149af09dcef32/uploader-client-0.2.2.tar.gz",
"platform": null,
"description": "# \u041a\u043b\u0438\u0435\u043d\u0442 \u0434\u043b\u044f \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441 \u0420\u0412\u0414 \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c \u0410\u0434\u0430\u043f\u0442\u0435\u0440\u0430\n## \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\nsettings:\n\n INSTALLED_APPS = [\n 'uploader_client',\n ]\n\n\napps:\n\n from django.apps import AppConfig as AppConfigBase\n\n class AppConfig(AppConfigBase):\n \n name = __package__\n \n def __setup_uploader_client(self):\n import uploader_client\n \n uploader_client.set_config(\n uploader_client.configuration.Config(\n agent_url='http://localhost:8090',\n system_mnemonics='MNSV03',\n timeout=1,\n request_retries=1,\n )\n )\n \n def ready(self):\n super().ready()\n self.__setup_uploader_client()\n\n## \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 Proxy API \u0434\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0432 \u0420\u0412\u0414\n\u0417\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043d\u0430 ProxyAPIInterface \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438:\n\n uploader_client.set_config(\n ...,\n RegionalDataMartUploaderConfig(\n interface='uploader_client.contrib.rdm.interfaces.rest.ProxyAPIInterface',\n cache=<cache>,\n url=<url>,\n datamart_name=<datamart_name>,\n organization_ogrn=<organization_ogrn>,\n installation_name=<installation_name>,\n installation_id=<installation_id>,\n username=<username>,\n password=<username>,\n )\n )\n\u0433\u0434\u0435\n- cache - \u043a\u0435\u0448 django \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0442\u043e\u043a\u0435\u043d\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, `caches[DEFAULT_CACHE_ALIAS]`);\n- url - URL \u0434\u043e \u0445\u043e\u0441\u0442\u0430 Datamart Studio;\n- datamart_name - \u043c\u043d\u0435\u043c\u043e\u043d\u0438\u043a\u0430 \u0412\u0438\u0442\u0440\u0438\u043d\u044b;\n- organization_ogrn - \u041e\u0413\u0420\u041d \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0438, \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0440\u0430\u0437\u0432\u0451\u0440\u043d\u0443\u0442\u0430 \u0412\u0438\u0442\u0440\u0438\u043d\u0430;\n- installation_name - \u0438\u043c\u044f \u0438\u043d\u0441\u0442\u0430\u043b\u043b\u044f\u0446\u0438\u0438 \u0432 \u0446\u0435\u043b\u0435\u0432\u043e\u0439 \u0412\u0438\u0442\u0440\u0438\u043d\u0435;\n- installation_id - \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0438\u043d\u0441\u0442\u0430\u043b\u043b\u044f\u0446\u0438\u0438;\n- username - \u0438\u043c\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f IAM;\n- password - \u043f\u0430\u0440\u043e\u043b\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f IAM.\n \n\n## \u042d\u043c\u0443\u043b\u044f\u0446\u0438\u044f\n\u0417\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043d\u0430 \u044d\u043c\u0443\u043b\u0438\u0440\u0443\u044e\u0449\u0438\u0439 \u0437\u0430\u043f\u0440\u043e\u0441\u044b:\n\n uploader_client.set_config(\n ...,\n uploader_client.configuration.Config(\n interface=(\n 'uploader_client.contrib.rdm.interfaces.rest'\n '.OpenAPIInterfaceEmulation'\n )\n )\n )\n\n## \u0417\u0430\u043f\u0443\u0441\u043a \u0442\u0435\u0441\u0442\u043e\u0432\n $ tox\n\n## API\n\n### \u041f\u0435\u0440\u0435\u0434\u0430\u0447\u0430 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f\n\n from uploader_client.adapters import adapter\n from uploader_client.interfaces import OpenAPIRequest\n\n class Request(OpenAPIRequest):\n\n def get_url(self):\n return 'http://localhost:8090/MNSV03/myedu/api/edu-upload/v1/multipart/csv'\n \n def get_method(self):\n return 'post'\n \n def get_files(self) -> List[str]:\n return [\n Path('files/myedu_schools.csv').as_posix()\n ]\n\n result = adapter.send(Request())\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "\u041a\u043b\u0438\u0435\u043d\u0442 \u0434\u043b\u044f \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441 \u0417\u0430\u0433\u0440\u0443\u0437\u0447\u0438\u043a\u043e\u043c \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0432\u0438\u0442\u0440\u0438\u043d\u0443",
"version": "0.2.2",
"project_urls": null,
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "62d0c3e6444724389f5f28d7afa0ef8a037ae909a4e1a183117de95f305a77f1",
"md5": "4bc5084d0e84ed40f16837594fabf10d",
"sha256": "2f57f06d23416bc2e94091950fa4414f6860bd7bc9b3c1753da583cb52adcefa"
},
"downloads": -1,
"filename": "uploader_client-0.2.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "4bc5084d0e84ed40f16837594fabf10d",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 22645,
"upload_time": "2024-03-04T07:32:39",
"upload_time_iso_8601": "2024-03-04T07:32:39.067475Z",
"url": "https://files.pythonhosted.org/packages/62/d0/c3e6444724389f5f28d7afa0ef8a037ae909a4e1a183117de95f305a77f1/uploader_client-0.2.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "f89e2b529e4e1b8901c7d75ed9ceedc9872851d4c1c4c6883b8149af09dcef32",
"md5": "2d96e7a4c39a80309870b6193bec2386",
"sha256": "2995fa4f2edf828874d9c2af61c3e52fbcf9fb840a3fc271789cff46711bb6d6"
},
"downloads": -1,
"filename": "uploader-client-0.2.2.tar.gz",
"has_sig": false,
"md5_digest": "2d96e7a4c39a80309870b6193bec2386",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 17750,
"upload_time": "2024-03-04T07:32:41",
"upload_time_iso_8601": "2024-03-04T07:32:41.061545Z",
"url": "https://files.pythonhosted.org/packages/f8/9e/2b529e4e1b8901c7d75ed9ceedc9872851d4c1c4c6883b8149af09dcef32/uploader-client-0.2.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-03-04 07:32:41",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "uploader-client"
}