pygeai 0.6.0b13__py3-none-any.whl → 0.6.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pygeai/__init__.py +1 -2
- pygeai/_docs/source/content/api_reference/project.rst +392 -0
- pygeai/_docs/source/content/authentication.rst +130 -1
- pygeai/_docs/source/content/debugger.rst +327 -157
- pygeai/_docs/source/content/migration.rst +391 -7
- pygeai/_docs/source/pygeai.core.common.rst +8 -0
- pygeai/_docs/source/pygeai.tests.auth.rst +56 -0
- pygeai/_docs/source/pygeai.tests.cli.rst +8 -0
- pygeai/admin/clients.py +1 -3
- pygeai/analytics/clients.py +1 -1
- pygeai/assistant/clients.py +2 -7
- pygeai/assistant/data/clients.py +0 -8
- pygeai/assistant/data_analyst/clients.py +0 -2
- pygeai/assistant/managers.py +1 -1
- pygeai/assistant/rag/clients.py +0 -2
- pygeai/assistant/rag/mappers.py +9 -11
- pygeai/auth/clients.py +26 -7
- pygeai/auth/endpoints.py +2 -1
- pygeai/chat/clients.py +2 -2
- pygeai/chat/managers.py +1 -1
- pygeai/cli/commands/admin.py +13 -25
- pygeai/cli/commands/analytics.py +56 -88
- pygeai/cli/commands/assistant.py +84 -138
- pygeai/cli/commands/auth.py +23 -46
- pygeai/cli/commands/base.py +0 -1
- pygeai/cli/commands/chat.py +218 -209
- pygeai/cli/commands/common.py +5 -5
- pygeai/cli/commands/configuration.py +79 -29
- pygeai/cli/commands/docs.py +3 -4
- pygeai/cli/commands/embeddings.py +13 -19
- pygeai/cli/commands/evaluation.py +133 -344
- pygeai/cli/commands/feedback.py +7 -15
- pygeai/cli/commands/files.py +26 -53
- pygeai/cli/commands/gam.py +28 -69
- pygeai/cli/commands/lab/ai_lab.py +96 -142
- pygeai/cli/commands/lab/common.py +1 -1
- pygeai/cli/commands/lab/spec.py +12 -32
- pygeai/cli/commands/llm.py +9 -18
- pygeai/cli/commands/migrate.py +43 -99
- pygeai/cli/commands/organization.py +223 -196
- pygeai/cli/commands/rag.py +35 -58
- pygeai/cli/commands/rerank.py +21 -25
- pygeai/cli/commands/secrets.py +39 -67
- pygeai/cli/commands/usage_limits.py +50 -136
- pygeai/cli/commands/validators.py +1 -1
- pygeai/cli/geai.py +32 -3
- pygeai/cli/geai_proxy.py +6 -2
- pygeai/cli/install_man.py +1 -1
- pygeai/cli/parsers.py +1 -1
- pygeai/core/base/clients.py +90 -21
- pygeai/core/base/mappers.py +39 -55
- pygeai/core/base/session.py +134 -22
- pygeai/core/common/config.py +50 -13
- pygeai/core/common/constants.py +8 -0
- pygeai/core/common/exceptions.py +6 -0
- pygeai/core/embeddings/clients.py +0 -1
- pygeai/core/embeddings/managers.py +0 -1
- pygeai/core/feedback/clients.py +0 -2
- pygeai/core/feedback/models.py +1 -1
- pygeai/core/files/clients.py +0 -3
- pygeai/core/files/managers.py +1 -1
- pygeai/core/files/mappers.py +4 -5
- pygeai/core/llm/clients.py +0 -1
- pygeai/core/models.py +4 -4
- pygeai/core/plugins/clients.py +0 -3
- pygeai/core/plugins/models.py +2 -2
- pygeai/core/rerank/clients.py +0 -2
- pygeai/core/secrets/clients.py +0 -2
- pygeai/core/services/rest.py +80 -14
- pygeai/core/singleton.py +24 -0
- pygeai/dbg/__init__.py +2 -2
- pygeai/dbg/debugger.py +276 -38
- pygeai/evaluation/clients.py +2 -4
- pygeai/evaluation/dataset/clients.py +0 -1
- pygeai/evaluation/plan/clients.py +0 -2
- pygeai/evaluation/result/clients.py +0 -2
- pygeai/gam/clients.py +1 -3
- pygeai/health/clients.py +1 -3
- pygeai/lab/clients.py +0 -1
- pygeai/lab/managers.py +0 -1
- pygeai/lab/models.py +0 -1
- pygeai/lab/strategies/clients.py +1 -2
- pygeai/lab/tools/clients.py +2 -2
- pygeai/lab/tools/mappers.py +1 -1
- pygeai/migration/strategies.py +5 -6
- pygeai/migration/tools.py +1 -1
- pygeai/organization/clients.py +118 -12
- pygeai/organization/endpoints.py +1 -0
- pygeai/organization/limits/clients.py +4 -6
- pygeai/organization/limits/managers.py +1 -4
- pygeai/organization/managers.py +2 -2
- pygeai/proxy/config.py +1 -0
- pygeai/proxy/managers.py +6 -5
- pygeai/tests/admin/test_clients.py +11 -11
- pygeai/tests/assistants/rag/test_clients.py +1 -1
- pygeai/tests/assistants/rag/test_models.py +1 -2
- pygeai/tests/assistants/test_clients.py +1 -1
- pygeai/tests/assistants/test_managers.py +1 -3
- pygeai/tests/auth/test_cli_configuration.py +252 -0
- pygeai/tests/auth/test_client_initialization.py +411 -0
- pygeai/tests/auth/test_clients.py +29 -27
- pygeai/tests/auth/test_config_manager.py +305 -0
- pygeai/tests/auth/test_header_injection.py +294 -0
- pygeai/tests/auth/test_oauth.py +3 -1
- pygeai/tests/auth/test_session_logging.py +119 -0
- pygeai/tests/auth/test_session_validation.py +408 -0
- pygeai/tests/auth/test_singleton_reset.py +201 -0
- pygeai/tests/chat/test_clients.py +1 -1
- pygeai/tests/chat/test_iris.py +1 -1
- pygeai/tests/chat/test_ui.py +0 -2
- pygeai/tests/cli/commands/lab/test_ai_lab.py +1 -3
- pygeai/tests/cli/commands/lab/test_common.py +0 -1
- pygeai/tests/cli/commands/test_chat.py +1 -1
- pygeai/tests/cli/commands/test_common.py +0 -1
- pygeai/tests/cli/commands/test_embeddings.py +2 -2
- pygeai/tests/cli/commands/test_evaluation.py +1 -9
- pygeai/tests/cli/commands/test_llm.py +1 -1
- pygeai/tests/cli/commands/test_migrate.py +1 -1
- pygeai/tests/cli/commands/test_rerank.py +0 -1
- pygeai/tests/cli/commands/test_secrets.py +1 -1
- pygeai/tests/cli/commands/test_show_help.py +0 -1
- pygeai/tests/cli/commands/test_validators.py +0 -1
- pygeai/tests/cli/test_credentials_flag.py +312 -0
- pygeai/tests/cli/test_error_handler.py +0 -1
- pygeai/tests/core/base/test_mappers.py +2 -2
- pygeai/tests/core/base/test_models.py +4 -4
- pygeai/tests/core/common/test_config.py +2 -7
- pygeai/tests/core/common/test_decorators.py +0 -1
- pygeai/tests/core/embeddings/test_managers.py +1 -1
- pygeai/tests/core/feedback/test_clients.py +2 -2
- pygeai/tests/core/files/test_clients.py +6 -6
- pygeai/tests/core/files/test_models.py +0 -1
- pygeai/tests/core/files/test_responses.py +0 -1
- pygeai/tests/core/llm/test_clients.py +1 -1
- pygeai/tests/core/plugins/test_clients.py +4 -4
- pygeai/tests/core/rerank/test_mappers.py +1 -3
- pygeai/tests/core/secrets/test_clients.py +2 -3
- pygeai/tests/core/services/test_rest.py +10 -10
- pygeai/tests/core/utils/test_console.py +0 -1
- pygeai/tests/dbg/test_debugger.py +95 -8
- pygeai/tests/evaluation/dataset/test_clients.py +24 -27
- pygeai/tests/evaluation/plan/test_clients.py +16 -18
- pygeai/tests/evaluation/result/test_clients.py +4 -5
- pygeai/tests/health/test_clients.py +2 -2
- pygeai/tests/integration/lab/agents/test_create_agent.py +1 -3
- pygeai/tests/integration/lab/agents/test_get_agent.py +1 -1
- pygeai/tests/integration/lab/processes/test_create_process.py +2 -2
- pygeai/tests/integration/lab/processes/test_create_task.py +2 -3
- pygeai/tests/integration/lab/processes/test_delete_process.py +0 -1
- pygeai/tests/integration/lab/processes/test_get_process.py +2 -4
- pygeai/tests/integration/lab/processes/test_list_process_instances.py +1 -3
- pygeai/tests/integration/lab/processes/test_update_process.py +3 -9
- pygeai/tests/integration/lab/reasoning_strategies/test_update_reasoning_strategy.py +1 -2
- pygeai/tests/integration/lab/tools/test_delete_tool.py +1 -1
- pygeai/tests/integration/lab/tools/test_list_tools.py +1 -1
- pygeai/tests/integration/lab/tools/test_update_tool.py +1 -1
- pygeai/tests/lab/agents/test_clients.py +17 -17
- pygeai/tests/lab/processes/test_clients.py +67 -67
- pygeai/tests/lab/processes/test_mappers.py +23 -23
- pygeai/tests/lab/spec/test_loader.py +0 -2
- pygeai/tests/lab/spec/test_parsers.py +1 -2
- pygeai/tests/lab/strategies/test_clients.py +10 -10
- pygeai/tests/lab/test_managers.py +3 -5
- pygeai/tests/lab/test_mappers.py +1 -4
- pygeai/tests/lab/tools/test_clients.py +21 -21
- pygeai/tests/lab/tools/test_mappers.py +0 -1
- pygeai/tests/organization/limits/test_clients.py +33 -33
- pygeai/tests/organization/limits/test_managers.py +7 -7
- pygeai/tests/organization/test_clients.py +78 -60
- pygeai/tests/proxy/test_clients.py +1 -1
- pygeai/tests/proxy/test_integration.py +1 -4
- pygeai/tests/proxy/test_managers.py +1 -2
- pygeai/tests/proxy/test_servers.py +1 -2
- pygeai/tests/snippets/assistants/rag/delete_rag_assistant.py +0 -1
- pygeai/tests/snippets/assistants/rag/get_documents.py +0 -1
- pygeai/tests/snippets/assistants/rag/get_rag_assistant_data.py +0 -1
- pygeai/tests/snippets/chat/get_request_status.py +0 -1
- pygeai/tests/snippets/dbg/file_debugging.py +72 -0
- pygeai/tests/snippets/dbg/module_debugging.py +60 -0
- pygeai/tests/snippets/embeddings/cohere_example.py +2 -2
- pygeai/tests/snippets/embeddings/openai_base64_example.py +1 -1
- pygeai/tests/snippets/evaluation/dataset/complete_workflow_example.py +8 -8
- pygeai/tests/snippets/evaluation/plan/complete_workflow_example.py +5 -5
- pygeai/tests/snippets/evaluation/result/complete_workflow_example.py +3 -3
- pygeai/tests/snippets/lab/agentic_flow_example_1.py +1 -1
- pygeai/tests/snippets/lab/agentic_flow_example_2.py +3 -4
- pygeai/tests/snippets/lab/agents/create_agent_with_permissions.py +2 -2
- pygeai/tests/snippets/lab/agents/delete_agent.py +1 -2
- pygeai/tests/snippets/lab/agents/get_agent.py +1 -1
- pygeai/tests/snippets/lab/agents/get_agent_with_new_fields.py +10 -10
- pygeai/tests/snippets/lab/agents/get_sharing_link.py +0 -1
- pygeai/tests/snippets/lab/agents/list_agents.py +1 -1
- pygeai/tests/snippets/lab/agents/publish_agent_revision.py +0 -1
- pygeai/tests/snippets/lab/agents/update_agent_properties.py +1 -1
- pygeai/tests/snippets/lab/crud_ui.py +3 -5
- pygeai/tests/snippets/lab/processes/kbs/get_kb.py +0 -1
- pygeai/tests/snippets/lab/processes/kbs/list_kbs.py +0 -1
- pygeai/tests/snippets/lab/processes/list_processes.py +1 -1
- pygeai/tests/snippets/lab/samples/summarize_files.py +0 -3
- pygeai/tests/snippets/lab/strategies/get_reasoning_strategy.py +0 -1
- pygeai/tests/snippets/lab/strategies/list_reasoning_strategies.py +1 -1
- pygeai/tests/snippets/lab/tools/get_tool.py +1 -1
- pygeai/tests/snippets/lab/tools/publish_tool_revision.py +0 -1
- pygeai/tests/snippets/lab/tools/set_parameters.py +1 -2
- pygeai/tests/snippets/lab/use_cases/c_code_fixer_agent_flow.py +2 -3
- pygeai/tests/snippets/lab/use_cases/file_summarizer_example_2.py +1 -1
- pygeai/tests/snippets/lab/use_cases/update_cli_expert.py +0 -1
- pygeai/tests/snippets/lab/use_cases/update_lab_expert.py +0 -1
- pygeai/tests/snippets/lab/use_cases/update_web_designer.py +0 -1
- pygeai/tests/snippets/lab/use_cases/update_web_reader.py +0 -1
- pygeai/tests/snippets/migrate/orchestrator_examples.py +1 -1
- {pygeai-0.6.0b13.dist-info → pygeai-0.6.1.dist-info}/METADATA +32 -7
- {pygeai-0.6.0b13.dist-info → pygeai-0.6.1.dist-info}/RECORD +217 -206
- {pygeai-0.6.0b13.dist-info → pygeai-0.6.1.dist-info}/WHEEL +0 -0
- {pygeai-0.6.0b13.dist-info → pygeai-0.6.1.dist-info}/entry_points.txt +0 -0
- {pygeai-0.6.0b13.dist-info → pygeai-0.6.1.dist-info}/licenses/LICENSE +0 -0
- {pygeai-0.6.0b13.dist-info → pygeai-0.6.1.dist-info}/top_level.txt +0 -0
pygeai/cli/commands/feedback.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from pygeai.cli.commands import Command, Option, ArgumentsEnum
|
|
2
2
|
from pygeai.cli.commands.builders import build_help_text
|
|
3
3
|
from pygeai.cli.texts.help import FEEDBACK_HELP_TEXT
|
|
4
|
-
from pygeai.core.common.exceptions import MissingRequirementException
|
|
4
|
+
from pygeai.core.common.exceptions import MissingRequirementException
|
|
5
5
|
from pygeai.core.feedback.clients import FeedbackClient
|
|
6
6
|
from pygeai.core.utils.console import Console
|
|
7
7
|
|
|
@@ -15,20 +15,12 @@ def show_help():
|
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
def send_feedback(option_list: list):
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
if option_flag.name == "request_id":
|
|
25
|
-
request_id = option_arg
|
|
26
|
-
if option_flag.name == "origin":
|
|
27
|
-
origin = option_arg
|
|
28
|
-
if option_flag.name == "answer_score":
|
|
29
|
-
answer_score = option_arg
|
|
30
|
-
if option_flag.name == "comments":
|
|
31
|
-
comments = option_arg
|
|
18
|
+
opts = {opt.name: arg for opt, arg in option_list}
|
|
19
|
+
|
|
20
|
+
request_id = opts.get('request_id')
|
|
21
|
+
origin = opts.get('origin', 'user-feedback')
|
|
22
|
+
answer_score = opts.get('answer_score')
|
|
23
|
+
comments = opts.get('comments')
|
|
32
24
|
|
|
33
25
|
if not (request_id and answer_score and answer_score):
|
|
34
26
|
raise MissingRequirementException("Cannot send feedback without specifying request_id and answer_score")
|
pygeai/cli/commands/files.py
CHANGED
|
@@ -15,22 +15,13 @@ def show_help():
|
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
def upload_file(option_list: list):
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
organization = option_arg
|
|
26
|
-
if option_flag.name == "project":
|
|
27
|
-
project = option_arg
|
|
28
|
-
if option_flag.name == "file_name":
|
|
29
|
-
file_name = option_arg
|
|
30
|
-
if option_flag.name == "file_path":
|
|
31
|
-
file_path = option_arg
|
|
32
|
-
if option_flag.name == "folder":
|
|
33
|
-
folder = option_arg
|
|
18
|
+
opts = {opt.name: arg for opt, arg in option_list}
|
|
19
|
+
|
|
20
|
+
organization = opts.get('organization')
|
|
21
|
+
project = opts.get('project')
|
|
22
|
+
file_name = opts.get('file_name')
|
|
23
|
+
file_path = opts.get('file_path')
|
|
24
|
+
folder = opts.get('folder')
|
|
34
25
|
|
|
35
26
|
if not (organization and project and file_path):
|
|
36
27
|
raise MissingRequirementException("Organization ID, Project ID and File path are mandatory parameters in order "
|
|
@@ -82,16 +73,11 @@ upload_file_options = [
|
|
|
82
73
|
|
|
83
74
|
|
|
84
75
|
def get_file(option_list: list):
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
organization = option_arg
|
|
91
|
-
if option_flag.name == "project":
|
|
92
|
-
project = option_arg
|
|
93
|
-
if option_flag.name == "file_id":
|
|
94
|
-
file_id = option_arg
|
|
76
|
+
opts = {opt.name: arg for opt, arg in option_list}
|
|
77
|
+
|
|
78
|
+
organization = opts.get('organization')
|
|
79
|
+
project = opts.get('project')
|
|
80
|
+
file_id = opts.get('file_id')
|
|
95
81
|
|
|
96
82
|
if not (organization and project and file_id):
|
|
97
83
|
raise MissingRequirementException("Cannot get file without organization, project and file_id.")
|
|
@@ -128,16 +114,11 @@ get_file_options = [
|
|
|
128
114
|
|
|
129
115
|
|
|
130
116
|
def delete_file(option_list: list):
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
organization = option_arg
|
|
137
|
-
if option_flag.name == "project":
|
|
138
|
-
project = option_arg
|
|
139
|
-
if option_flag.name == "file_id":
|
|
140
|
-
file_id = option_arg
|
|
117
|
+
opts = {opt.name: arg for opt, arg in option_list}
|
|
118
|
+
|
|
119
|
+
organization = opts.get('organization')
|
|
120
|
+
project = opts.get('project')
|
|
121
|
+
file_id = opts.get('file_id')
|
|
141
122
|
|
|
142
123
|
if not (organization and project and file_id):
|
|
143
124
|
raise MissingRequirementException("Cannot delete file without organization, project and file_id.")
|
|
@@ -174,16 +155,11 @@ delete_file_options = [
|
|
|
174
155
|
|
|
175
156
|
|
|
176
157
|
def get_file_content(option_list: list):
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
organization = option_arg
|
|
183
|
-
if option_flag.name == "project":
|
|
184
|
-
project = option_arg
|
|
185
|
-
if option_flag.name == "file_id":
|
|
186
|
-
file_id = option_arg
|
|
158
|
+
opts = {opt.name: arg for opt, arg in option_list}
|
|
159
|
+
|
|
160
|
+
organization = opts.get('organization')
|
|
161
|
+
project = opts.get('project')
|
|
162
|
+
file_id = opts.get('file_id')
|
|
187
163
|
|
|
188
164
|
if not (organization and project and file_id):
|
|
189
165
|
raise MissingRequirementException("Cannot get file content without organization, project and file_id.")
|
|
@@ -220,13 +196,10 @@ get_file_content_options = [
|
|
|
220
196
|
|
|
221
197
|
|
|
222
198
|
def get_file_list(option_list: list):
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
organization = option_arg
|
|
228
|
-
if option_flag.name == "project":
|
|
229
|
-
project = option_arg
|
|
199
|
+
opts = {opt.name: arg for opt, arg in option_list}
|
|
200
|
+
|
|
201
|
+
organization = opts.get('organization')
|
|
202
|
+
project = opts.get('project')
|
|
230
203
|
|
|
231
204
|
if not (organization and project):
|
|
232
205
|
raise MissingRequirementException("Cannot file list without organization and project id.")
|
pygeai/cli/commands/gam.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from pygeai.cli.commands import Command, Option, ArgumentsEnum
|
|
2
2
|
from pygeai.cli.commands.builders import build_help_text
|
|
3
3
|
from pygeai.cli.texts.help import GAM_HELP_TEXT
|
|
4
|
-
from pygeai.core.common.exceptions import MissingRequirementException
|
|
4
|
+
from pygeai.core.common.exceptions import MissingRequirementException
|
|
5
5
|
from pygeai.core.utils.console import Console
|
|
6
6
|
from pygeai.gam.clients import GAMClient
|
|
7
7
|
|
|
@@ -15,23 +15,13 @@ def show_help():
|
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
def generate_signin_url(option_list: list):
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
if option_flag.name == "client_id":
|
|
26
|
-
client_id = option_arg
|
|
27
|
-
if option_flag.name == "redirect_uri":
|
|
28
|
-
redirect_uri = option_arg
|
|
29
|
-
if option_flag.name == "scope":
|
|
30
|
-
scope = option_arg
|
|
31
|
-
if option_flag.name == "state":
|
|
32
|
-
state = option_arg
|
|
33
|
-
if option_flag.name == "response_type":
|
|
34
|
-
response_type = option_arg
|
|
18
|
+
opts = {opt.name: arg for opt, arg in option_list}
|
|
19
|
+
|
|
20
|
+
client_id = opts.get('client_id')
|
|
21
|
+
redirect_uri = opts.get('redirect_uri')
|
|
22
|
+
scope = opts.get('scope', "gam_user_data")
|
|
23
|
+
state = opts.get('state')
|
|
24
|
+
response_type = opts.get('response_type', "code")
|
|
35
25
|
|
|
36
26
|
if not all([client_id, redirect_uri, state]):
|
|
37
27
|
raise MissingRequirementException("client_id, redirect_uri, and state are required for generating signin URL")
|
|
@@ -82,38 +72,18 @@ generate_signin_url_options = [
|
|
|
82
72
|
|
|
83
73
|
|
|
84
74
|
def get_access_token(option_list: list):
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
if option_flag.name == "client_id":
|
|
98
|
-
client_id = option_arg
|
|
99
|
-
if option_flag.name == "client_secret":
|
|
100
|
-
client_secret = option_arg
|
|
101
|
-
if option_flag.name == "grant_type":
|
|
102
|
-
grant_type = option_arg
|
|
103
|
-
if option_flag.name == "authentication_type_name":
|
|
104
|
-
authentication_type_name = option_arg
|
|
105
|
-
if option_flag.name == "scope":
|
|
106
|
-
scope = option_arg
|
|
107
|
-
if option_flag.name == "username":
|
|
108
|
-
username = option_arg
|
|
109
|
-
if option_flag.name == "password":
|
|
110
|
-
password = option_arg
|
|
111
|
-
if option_flag.name == "initial_properties":
|
|
112
|
-
initial_properties = option_arg
|
|
113
|
-
if option_flag.name == "repository":
|
|
114
|
-
repository = option_arg
|
|
115
|
-
if option_flag.name == "request_token_type":
|
|
116
|
-
request_token_type = option_arg
|
|
75
|
+
opts = {opt.name: arg for opt, arg in option_list}
|
|
76
|
+
|
|
77
|
+
client_id = opts.get('client_id')
|
|
78
|
+
client_secret = opts.get('client_secret')
|
|
79
|
+
grant_type = opts.get('grant_type', "password")
|
|
80
|
+
authentication_type_name = opts.get('authentication_type_name', "local")
|
|
81
|
+
scope = opts.get('scope', "gam_user_data")
|
|
82
|
+
username = opts.get('username')
|
|
83
|
+
password = opts.get('password')
|
|
84
|
+
initial_properties = opts.get('initial_properties')
|
|
85
|
+
repository = opts.get('repository')
|
|
86
|
+
request_token_type = opts.get('request_token_type', "OAuth")
|
|
117
87
|
|
|
118
88
|
if not ((client_id and client_secret) or (username and password)):
|
|
119
89
|
raise MissingRequirementException("Cannot get access token without specifying valid credentials")
|
|
@@ -201,11 +171,8 @@ get_access_token_options = [
|
|
|
201
171
|
|
|
202
172
|
|
|
203
173
|
def get_user_info(option_list: list):
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
for option_flag, option_arg in option_list:
|
|
207
|
-
if option_flag.name == "access_token":
|
|
208
|
-
access_token = option_arg
|
|
174
|
+
opts = {opt.name: arg for opt, arg in option_list}
|
|
175
|
+
access_token = opts.get('access_token')
|
|
209
176
|
|
|
210
177
|
if not access_token:
|
|
211
178
|
raise MissingRequirementException("Cannot get user info without the access token")
|
|
@@ -228,20 +195,12 @@ get_user_info_options = [
|
|
|
228
195
|
|
|
229
196
|
|
|
230
197
|
def refresh_access_token(option_list: list):
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
if option_flag.name == "client_id":
|
|
238
|
-
client_id = option_arg
|
|
239
|
-
if option_flag.name == "client_secret":
|
|
240
|
-
client_secret = option_arg
|
|
241
|
-
if option_flag.name == "grant_type":
|
|
242
|
-
grant_type = option_arg
|
|
243
|
-
if option_flag.name == "refresh_token":
|
|
244
|
-
refresh_token = option_arg
|
|
198
|
+
opts = {opt.name: arg for opt, arg in option_list}
|
|
199
|
+
|
|
200
|
+
client_id = opts.get('client_id')
|
|
201
|
+
client_secret = opts.get('client_secret')
|
|
202
|
+
grant_type = opts.get('grant_type', "refresh_token")
|
|
203
|
+
refresh_token = opts.get('refresh_token')
|
|
245
204
|
|
|
246
205
|
if not ((client_id and client_secret) or refresh_token):
|
|
247
206
|
raise MissingRequirementException("Cannot refresh access token without specifying valid credentials")
|