Showing
13 changed files
with
133 additions
and
85 deletions
LICENSE.md
0 → 100644
1 | +BSD 3-Clause License | |
2 | + | |
3 | +Copyright (c) 2024, Novosibirsk State University, Ai-Center | |
4 | +All rights reserved. | |
5 | + | |
6 | +Redistribution and use in source and binary forms, with or without | |
7 | +modification, are permitted provided that the following conditions are met: | |
8 | + | |
9 | +1. Redistributions of source code must retain the above copyright notice, this | |
10 | + list of conditions and the following disclaimer. | |
11 | + | |
12 | +2. Redistributions in binary form must reproduce the above copyright notice, | |
13 | + this list of conditions and the following disclaimer in the documentation | |
14 | + and/or other materials provided with the distribution. | |
15 | + | |
16 | +3. Neither the name of the copyright holder nor the names of its | |
17 | + contributors may be used to endorse or promote products derived from | |
18 | + this software without specific prior written permission. | |
19 | + | |
20 | +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | |
21 | +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
22 | +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |
23 | +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | |
24 | +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
25 | +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | |
26 | +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | |
27 | +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |
28 | +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
29 | +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ... | ... |
1 | -# openapi-client | |
1 | +# kf_sdk | |
2 | 2 | |
3 | 3 | Kappa Framwork Python SDK for Kappa v.1.0.0 |
4 | 4 | |
5 | -(generated by Openapi Generator https://github.com/openapitools/openapi-generator) | |
6 | - | |
7 | -This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: | |
8 | - | |
9 | 5 | - API version: 0.1.0 |
10 | 6 | - Package version: 1.0.0 |
11 | -- Generator version: 7.11.0-SNAPSHOT | |
12 | -- Build package: org.openapitools.codegen.languages.PythonClientCodegen | |
13 | 7 | |
14 | 8 | ## Requirements. |
15 | 9 | |
... | ... | @@ -21,13 +15,13 @@ Python 3.8+ |
21 | 15 | If the python package is hosted on a repository, you can install directly using: |
22 | 16 | |
23 | 17 | ```sh |
24 | -pip install git+https://bigdata.nsu.ru:7445/nsu-ai/kappa-sdk.git | |
18 | +pip install kf_sdk | |
25 | 19 | ``` |
26 | -(you may need to run `pip` with root permission: `sudo pip install git+https://bigdata.nsu.ru:7445/nsu-ai/kappa-sdk.git`) | |
20 | +(you may need to run `pip` with root permission: `sudo pip install kf_sdk`) | |
27 | 21 | |
28 | 22 | Then import the package: |
29 | 23 | ```python |
30 | -import openapi_client | |
24 | +import kf_sdk | |
31 | 25 | ``` |
32 | 26 | |
33 | 27 | ### Setuptools |
... | ... | @@ -41,7 +35,7 @@ python setup.py install --user |
41 | 35 | |
42 | 36 | Then import the package: |
43 | 37 | ```python |
44 | -import openapi_client | |
38 | +import kf_sdk | |
45 | 39 | ``` |
46 | 40 | |
47 | 41 | ### Tests |
... | ... | @@ -54,32 +48,66 @@ Please follow the [installation procedure](#installation--usage) and then run th |
54 | 48 | |
55 | 49 | ```python |
56 | 50 | |
57 | -import openapi_client | |
58 | -from openapi_client.rest import ApiException | |
51 | +import kf_sdk | |
52 | +from kf_sdk.rest import ApiException | |
53 | +from kf_sdk.models import NewSession | |
59 | 54 | from pprint import pprint |
60 | 55 | |
61 | -# Defining the host is optional and defaults to http://localhost | |
56 | +# Defining the host is optional and defaults to http://localhost/user-micro-services/v1 | |
62 | 57 | # See configuration.py for a list of all supported configuration parameters. |
63 | -configuration = openapi_client.Configuration( | |
64 | - host = "http://localhost" | |
58 | +configuration_users = kf_sdk.Configuration( | |
59 | + host = "https://bigdata.nsu.ru:8460/user-micro-services/v1" | |
65 | 60 | ) |
61 | +# The client must configure the authentication and authorization parameters | |
62 | +# in accordance with the API server security policy. | |
63 | +# Examples for each auth method are provided below, use the example that | |
64 | +# satisfies your auth use case. | |
66 | 65 | |
66 | +# Configure Bearer authorization: HTTPBearer | |
67 | +#configuration = kappa_users.Configuration( | |
68 | +# access_token = os.environ["BEARER_TOKEN"] | |
69 | +#) | |
67 | 70 | |
68 | 71 | |
69 | 72 | # Enter a context with an instance of the API client |
70 | -with openapi_client.ApiClient(configuration) as api_client: | |
73 | +with kf_sdk.ApiClient(configuration_users) as api_client: | |
71 | 74 | # Create an instance of the API class |
72 | - api_instance = openapi_client.DashboardDataApi(api_client) | |
73 | - user_id = 56 # int | | |
74 | - user_type_id = 56 # int | | |
75 | + api_instance = kf_sdk.SessionManagementApi(api_client) | |
76 | + login_id = "anonymous" | |
77 | + passwd = "anonymous" | |
78 | + new_session = NewSession(login_id=login_id,passwd=passwd) | |
75 | 79 | |
76 | 80 | try: |
77 | - # Get Dashboard Data | |
78 | - api_response = api_instance.get_dashboard_data_dashboard_user_id_user_type_id_get(user_id, user_type_id) | |
79 | - print("The response of DashboardDataApi->get_dashboard_data_dashboard_user_id_user_type_id_get:\n") | |
81 | + # New Session | |
82 | + api_response = api_instance.get_new_session(new_session) | |
83 | + token = api_response.token | |
84 | + user_id = api_response.user_id | |
85 | + user_type_id = api_response.user_type_id | |
86 | + print("The response of SessionManagementApi->new_session_session_new_post:\n") | |
80 | 87 | pprint(api_response) |
81 | 88 | except ApiException as e: |
82 | - print("Exception when calling DashboardDataApi->get_dashboard_data_dashboard_user_id_user_type_id_get: %s\n" % e) | |
89 | + print("Exception when calling ExpertManagementApi->new_session_session_new_post: %s\n" % e) | |
90 | + | |
91 | +configuration_data = kf_sdk.Configuration( | |
92 | + host = "https://bigdata.nsu.ru:8460/data-micro-services/v1", | |
93 | + access_token = token | |
94 | +) | |
95 | + | |
96 | + | |
97 | +with kf_sdk.ApiClient(configuration_data) as api_client: | |
98 | + # Create an instance of the API class | |
99 | + api_instance = kf_sdk.DatasetManagementApi(api_client) | |
100 | + dataset_id = 582 | |
101 | + dataset_version_no = '1.0.0' | |
102 | + | |
103 | + try: | |
104 | + # Get Dataset Version | |
105 | + api_response = api_instance.get_dataset_version_archive_datasets_versions_archive_user_id_user_type_id_dataset_id_dataset_version_no_get_without_preload_content(user_id, user_type_id, dataset_id, dataset_version_no) | |
106 | + pprint(api_response) | |
107 | + with open("tmp.zip","wb") as f: | |
108 | + f.write(api_response.data) | |
109 | + except Exception as e: | |
110 | + print("Exception when calling DatasetManagementApi->get_dataset_version_datasets_versions_user_id_user_type_id_dataset_id_dataset_version_no_get: %s\n" % e) | |
83 | 111 | |
84 | 112 | ``` |
85 | 113 | |
... | ... | @@ -158,7 +186,12 @@ Mishchenko A., |
158 | 186 | Bolotov K. |
159 | 187 | |
160 | 188 | |
161 | -Исследование выполнено за счет финансовой поддержки (гранта) исследовательских центров, предоставленной Автономной некоммерческой организацией «Аналитический центр при Правительстве Российской Федерации», идентификатор соглашения о предоставлении субсидии 000000D730324P540002, договор о предоставлении гранта с Новосибирским государственным университетом от 27.12.2023 № 70-2023-001318. | |
189 | +Исследование выполнено за счет финансовой поддержки (гранта) исследовательских центров, | |
190 | +предоставленной Автономной некоммерческой организацией «Аналитический центр при Правительстве | |
191 | +Российской Федерации», идентификатор соглашения о предоставлении субсидии 000000D730324P540002, | |
192 | +договор о предоставлении гранта с Новосибирским государственным университетом от 27.12.2023 № 70-2023-001318, | |
193 | +мероприятие № 23 «Выполнение работ в 2024 г. по ТЗ (проект Научные исследования в области ИИ (Фреймворк «КАППА»))», | |
194 | +тематика Программы № 1 «Научные исследования в области ИИ для строительства и городской среды». | |
162 | 195 | |
163 | 196 | This work was supported by a grant for research centers, provided by the Analytical Center for |
164 | 197 | the Government of the Russian Federation in accordance with the subsidy agreement (agreement | ... | ... |
... | ... | @@ -5,12 +5,6 @@ |
5 | 5 | """ |
6 | 6 | Kappa-framework user microservices |
7 | 7 | |
8 | - No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) | |
9 | - | |
10 | - The version of the OpenAPI document: 0.1.0 | |
11 | - Generated by OpenAPI Generator (https://openapi-generator.tech) | |
12 | - | |
13 | - Do not edit the class manually. | |
14 | 8 | """ # noqa: E501 |
15 | 9 | |
16 | 10 | ... | ... |
... | ... | @@ -3,12 +3,6 @@ |
3 | 3 | """ |
4 | 4 | Kappa-framework user microservices |
5 | 5 | |
6 | - No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) | |
7 | - | |
8 | - The version of the OpenAPI document: 0.1.0 | |
9 | - Generated by OpenAPI Generator (https://openapi-generator.tech) | |
10 | - | |
11 | - Do not edit the class manually. | |
12 | 6 | """ # noqa: E501 |
13 | 7 | |
14 | 8 | ... | ... |
... | ... | @@ -3,12 +3,6 @@ |
3 | 3 | """ |
4 | 4 | Kappa-framework user microservices |
5 | 5 | |
6 | - No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) | |
7 | - | |
8 | - The version of the OpenAPI document: 0.1.0 | |
9 | - Generated by OpenAPI Generator (https://openapi-generator.tech) | |
10 | - | |
11 | - Do not edit the class manually. | |
12 | 6 | """ # noqa: E501 |
13 | 7 | |
14 | 8 | ... | ... |
... | ... | @@ -3,12 +3,6 @@ |
3 | 3 | """ |
4 | 4 | Kappa-framework user microservices |
5 | 5 | |
6 | - No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) | |
7 | - | |
8 | - The version of the OpenAPI document: 0.1.0 | |
9 | - Generated by OpenAPI Generator (https://openapi-generator.tech) | |
10 | - | |
11 | - Do not edit the class manually. | |
12 | 6 | """ # noqa: E501 |
13 | 7 | |
14 | 8 | from typing import Any, Optional | ... | ... |
... | ... | @@ -3,12 +3,6 @@ |
3 | 3 | """ |
4 | 4 | Kappa-framework user microservices |
5 | 5 | |
6 | - No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) | |
7 | - | |
8 | - The version of the OpenAPI document: 0.1.0 | |
9 | - Generated by OpenAPI Generator (https://openapi-generator.tech) | |
10 | - | |
11 | - Do not edit the class manually. | |
12 | 6 | """ # noqa: E501 |
13 | 7 | |
14 | 8 | ... | ... |
1 | 1 | [tool.poetry] |
2 | -name = "kappa_client" | |
2 | +name = "kf_sdk" | |
3 | 3 | version = "1.0.0" |
4 | 4 | description = "FastAPI" |
5 | 5 | authors = ["Kappa Group from A.I. center of NSU <ai@nsu.ru>"] |
6 | -license = "MIT License" | |
6 | +license = "BSD-3.0 License" | |
7 | 7 | readme = "README.md" |
8 | -repository = "https://bigdata.nsu.ru:7445/nsu-ai/kappa-sdk.git" | |
9 | -keywords = ["Kappa", "OpenAPI", "FastAPI"] | |
10 | -include = ["openapi_client/py.typed"] | |
8 | +repository = "https://github.com/nsu-ai/kappa.git" | |
9 | +keywords = ["Kappa", "Datasets Management", "FastAPI"] | |
10 | +include = ["kf_sdk/py.typed"] | |
11 | +classifiers = [ | |
12 | + "Programming Language :: Python :: 3", | |
13 | + "License :: OSI Approved :: BSD-3.0 License", | |
14 | + "Operating System :: OS Independent", | |
15 | +] | |
16 | + | |
17 | +[project] | |
18 | +name = "kf_sdk" | |
19 | +version = "1.0.0" | |
20 | +description = "FastAPI" | |
21 | +authors = [{name="Kappa Group from A.I. center of NSU",email="ai@nsu.ru"}] | |
22 | +license = {file="LICENSE.md"} | |
23 | +readme = "README.md" | |
24 | +keywords = ["Kappa", "Datasets Management", "FastAPI"] | |
25 | +classifiers = [ | |
26 | + "Programming Language :: Python :: 3", | |
27 | + "Operating System :: OS Independent", | |
28 | +] | |
11 | 29 | |
12 | 30 | [tool.poetry.dependencies] |
13 | 31 | python = "^3.8" |
14 | - | |
15 | 32 | urllib3 = ">= 1.25.3 < 3.0.0" |
16 | 33 | python-dateutil = ">= 2.8.2" |
17 | 34 | pydantic = ">= 2" |
... | ... | @@ -25,6 +42,11 @@ flake8 = ">= 4.0.0" |
25 | 42 | types-python-dateutil = ">= 2.8.19.14" |
26 | 43 | mypy = ">= 1.5" |
27 | 44 | |
45 | +[project.urls] | |
46 | +Homepage = "https://github.com/nsu-ai/kappa" | |
47 | +Issues = "https://github.com/nsu-ai/kappa/issues" | |
48 | +Repository = "https://github.com/nsu-ai/kappa.git" | |
49 | + | |
28 | 50 | |
29 | 51 | [build-system] |
30 | 52 | requires = ["setuptools"] |
... | ... | @@ -35,7 +57,7 @@ extension-pkg-whitelist = "pydantic" |
35 | 57 | |
36 | 58 | [tool.mypy] |
37 | 59 | files = [ |
38 | - "openapi_client", | |
60 | + "kf_sdk", | |
39 | 61 | #"test", # auto-generated tests |
40 | 62 | "tests", # hand-written tests |
41 | 63 | ] |
... | ... | @@ -73,7 +95,7 @@ disallow_any_generics = true |
73 | 95 | |
74 | 96 | [[tool.mypy.overrides]] |
75 | 97 | module = [ |
76 | - "openapi_client.configuration", | |
98 | + "kf_sdk.configuration", | |
77 | 99 | ] |
78 | 100 | warn_unused_ignores = true |
79 | 101 | strict_equality = true | ... | ... |
1 | 1 | # coding: utf-8 |
2 | 2 | |
3 | 3 | """ |
4 | - FastAPI | |
4 | + Kappa-Framework SDK based on FastAPI | |
5 | 5 | |
6 | - No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) | |
6 | + Kappa Framework for Datasets Management from NSU-AI Center | |
7 | 7 | |
8 | - The version of the OpenAPI document: 0.1.0 | |
9 | - Generated by OpenAPI Generator (https://openapi-generator.tech) | |
10 | - | |
11 | - Do not edit the class manually. | |
12 | 8 | """ # noqa: E501 |
13 | 9 | |
14 | 10 | |
... | ... | @@ -20,7 +16,7 @@ from setuptools import setup, find_packages # noqa: H301 |
20 | 16 | # |
21 | 17 | # prerequisite: setuptools |
22 | 18 | # http://pypi.python.org/pypi/setuptools |
23 | -NAME = "kappa-client" | |
19 | +NAME = "kf_sdk" | |
24 | 20 | VERSION = "1.0.0" |
25 | 21 | PYTHON_REQUIRES = ">= 3.8" |
26 | 22 | REQUIRES = [ |
... | ... | @@ -33,17 +29,18 @@ REQUIRES = [ |
33 | 29 | setup( |
34 | 30 | name=NAME, |
35 | 31 | version=VERSION, |
36 | - description="FastAPI", | |
32 | + description="Kappa Framework for Datasets Management from NSU-AI Center", | |
37 | 33 | author="Kappa group from A.I. Center of NSU", |
38 | 34 | author_email="ai@nsu.ru", |
39 | - url="", | |
40 | - keywords=["Kappa Framework", "OpenAPI-Generator", "FastAPI"], | |
35 | + url="https://github.com/nsu-ai/kappa", | |
36 | + keywords=["Kappa Framework", "Datasets Management", "FastAPI"], | |
41 | 37 | install_requires=REQUIRES, |
38 | + license="BSD-3.0 License", | |
42 | 39 | packages=find_packages(exclude=["test", "tests"]), |
43 | 40 | include_package_data=True, |
44 | 41 | long_description_content_type='text/markdown', |
45 | 42 | long_description="""\ |
46 | - Kappa Framwork Python SDK for Kappa v.1.0.0 (generated by Openapi Generator https://github.com/openapitools/openapi-generator) | |
43 | + Kappa Framwork Python SDK for Kappa v.1.0.0 | |
47 | 44 | """, # noqa: E501 |
48 | - package_data={"openapi_client": ["py.typed"]}, | |
45 | + package_data={"kf_sdk": ["py.typed"]}, | |
49 | 46 | ) | ... | ... |
... | ... | @@ -47,17 +47,14 @@ configuration_data = kf_sdk.Configuration( |
47 | 47 | with kf_sdk.ApiClient(configuration_data) as api_client: |
48 | 48 | # Create an instance of the API class |
49 | 49 | api_instance = kf_sdk.DatasetManagementApi(api_client) |
50 | - dataset_id = 581 | |
50 | + dataset_id = 582 | |
51 | 51 | dataset_version_no = '1.0.0' |
52 | 52 | |
53 | 53 | try: |
54 | 54 | # Get Dataset Version |
55 | - api_response = api_instance.get_dataset_version_datasets_versions_user_id_user_type_id_dataset_id_dataset_version_no_get(user_id, user_type_id, dataset_id, dataset_version_no) | |
56 | -# api_response = api_instance.get_dataset_version_archive_datasets_versions_archive_user_id_user_type_id_dataset_id_dataset_version_no_get(user_id, user_type_id, dataset_id, dataset_version_no) | |
57 | -# api_response = api_instance.get_dataset_version_archive_datasets_versions_archive_user_id_user_type_id_dataset_id_dataset_version_no_get_with_http_info(user_id, user_type_id, dataset_id, dataset_version_no) | |
58 | - # api_response = api_instance.get_dataset_version_archive_datasets_versions_archive_user_id_user_type_id_dataset_id_dataset_version_no_get_without_preload_content(user_id, user_type_id, dataset_id, dataset_version_no) | |
59 | - pprint(api_response) | |
60 | - # with open("tmp.zip","wb") as f: | |
61 | - # f.write(api_response.data) | |
55 | + api_response = api_instance.get_dataset_version_archive_datasets_versions_archive_user_id_user_type_id_dataset_id_dataset_version_no_get_without_preload_content(user_id, user_type_id, dataset_id, dataset_version_no) | |
56 | + pprint(api_response) | |
57 | + with open("tmp.zip","wb") as f: | |
58 | + f.write(api_response.data) | |
62 | 59 | except Exception as e: |
63 | 60 | print("Exception when calling DatasetManagementApi->get_dataset_version_datasets_versions_user_id_user_type_id_dataset_id_dataset_version_no_get: %s\n" % e) | ... | ... |
tmp.zip
0 → 100644
Please
register
or
login
to post a comment