Name | uploader-client JSON |
Version |
0.3.0
JSON |
| download |
home_page | None |
Summary | Клиент для взаимодействия с Загрузчиком данных в витрину |
upload_time | 2025-07-30 14:20:37 |
maintainer | None |
docs_url | None |
author | BARS Group |
requires_python | None |
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": null,
"name": "uploader-client",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": null,
"author": "BARS Group",
"author_email": "education_dev@bars-open.ru",
"download_url": "https://files.pythonhosted.org/packages/88/fa/b2fb38ab6f4351103030984663e5243a1fbe9ff79f8ba914b5a24be179e2/uploader_client-0.3.0.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.3.0",
"project_urls": null,
"split_keywords": [],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "9f9f9d685ca0f93c39013db2e342b44d865f35584d7874e556e758ea20ffe0e7",
"md5": "417d83978647c3faddf066e226330ce2",
"sha256": "063aa5449bad01a41bb48f13a368f3c6cd86bcfbb797e539e10ea47c6fb74b5d"
},
"downloads": -1,
"filename": "uploader_client-0.3.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "417d83978647c3faddf066e226330ce2",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 23098,
"upload_time": "2025-07-30T14:20:36",
"upload_time_iso_8601": "2025-07-30T14:20:36.523574Z",
"url": "https://files.pythonhosted.org/packages/9f/9f/9d685ca0f93c39013db2e342b44d865f35584d7874e556e758ea20ffe0e7/uploader_client-0.3.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "88fab2fb38ab6f4351103030984663e5243a1fbe9ff79f8ba914b5a24be179e2",
"md5": "f81a40cbe57e74d383d55d1469214e3b",
"sha256": "6d6142292e04a9fda49c7f02ba0c11b59600a51cc6bbbddc3ceb4f4245d57b8a"
},
"downloads": -1,
"filename": "uploader_client-0.3.0.tar.gz",
"has_sig": false,
"md5_digest": "f81a40cbe57e74d383d55d1469214e3b",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 18255,
"upload_time": "2025-07-30T14:20:37",
"upload_time_iso_8601": "2025-07-30T14:20:37.680672Z",
"url": "https://files.pythonhosted.org/packages/88/fa/b2fb38ab6f4351103030984663e5243a1fbe9ff79f8ba914b5a24be179e2/uploader_client-0.3.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-30 14:20:37",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "uploader-client"
}