das-cli 1.7.3__tar.gz → 1.7.4__tar.gz
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.
- {das_cli-1.7.3/das_cli.egg-info → das_cli-1.7.4}/PKG-INFO +1 -1
- {das_cli-1.7.3 → das_cli-1.7.4}/das/app.py +2 -1
- {das_cli-1.7.3 → das_cli-1.7.4}/das/cli.py +2 -1
- {das_cli-1.7.3 → das_cli-1.7.4}/das/common/config.py +10 -3
- {das_cli-1.7.3 → das_cli-1.7.4/das_cli.egg-info}/PKG-INFO +1 -1
- {das_cli-1.7.3 → das_cli-1.7.4}/pyproject.toml +1 -1
- {das_cli-1.7.3 → das_cli-1.7.4}/LICENSE +0 -0
- {das_cli-1.7.3 → das_cli-1.7.4}/MANIFEST.in +0 -0
- {das_cli-1.7.3 → das_cli-1.7.4}/README.md +0 -0
- {das_cli-1.7.3 → das_cli-1.7.4}/das/__init__.py +0 -0
- {das_cli-1.7.3 → das_cli-1.7.4}/das/ai/plugins/dasai.py +0 -0
- {das_cli-1.7.3 → das_cli-1.7.4}/das/ai/plugins/entries/entries_plugin.py +0 -0
- {das_cli-1.7.3 → das_cli-1.7.4}/das/authentication/auth.py +0 -0
- {das_cli-1.7.3 → das_cli-1.7.4}/das/authentication/oauth.py +0 -0
- {das_cli-1.7.3 → das_cli-1.7.4}/das/authentication/secure_input.py +0 -0
- {das_cli-1.7.3 → das_cli-1.7.4}/das/common/api.py +0 -0
- {das_cli-1.7.3 → das_cli-1.7.4}/das/common/entry_fields_constants.py +0 -0
- {das_cli-1.7.3 → das_cli-1.7.4}/das/common/enums.py +0 -0
- {das_cli-1.7.3 → das_cli-1.7.4}/das/common/errors.py +0 -0
- {das_cli-1.7.3 → das_cli-1.7.4}/das/common/exceptions.py +0 -0
- {das_cli-1.7.3 → das_cli-1.7.4}/das/common/file_utils.py +0 -0
- {das_cli-1.7.3 → das_cli-1.7.4}/das/managers/__init__.py +0 -0
- {das_cli-1.7.3 → das_cli-1.7.4}/das/managers/digital_objects_manager.py +0 -0
- {das_cli-1.7.3 → das_cli-1.7.4}/das/managers/download_manager.py +0 -0
- {das_cli-1.7.3 → das_cli-1.7.4}/das/managers/entries_manager.py +0 -0
- {das_cli-1.7.3 → das_cli-1.7.4}/das/managers/search_manager.py +0 -0
- {das_cli-1.7.3 → das_cli-1.7.4}/das/services/attributes.py +0 -0
- {das_cli-1.7.3 → das_cli-1.7.4}/das/services/cache.py +0 -0
- {das_cli-1.7.3 → das_cli-1.7.4}/das/services/das_elastic_search.py +0 -0
- {das_cli-1.7.3 → das_cli-1.7.4}/das/services/digital_objects.py +0 -0
- {das_cli-1.7.3 → das_cli-1.7.4}/das/services/downloads.py +0 -0
- {das_cli-1.7.3 → das_cli-1.7.4}/das/services/entries.py +0 -0
- {das_cli-1.7.3 → das_cli-1.7.4}/das/services/entry_fields.py +0 -0
- {das_cli-1.7.3 → das_cli-1.7.4}/das/services/hangfire.py +0 -0
- {das_cli-1.7.3 → das_cli-1.7.4}/das/services/search.py +0 -0
- {das_cli-1.7.3 → das_cli-1.7.4}/das/services/service_base.py +0 -0
- {das_cli-1.7.3 → das_cli-1.7.4}/das/services/session.py +0 -0
- {das_cli-1.7.3 → das_cli-1.7.4}/das/services/users.py +0 -0
- {das_cli-1.7.3 → das_cli-1.7.4}/das_cli.egg-info/SOURCES.txt +0 -0
- {das_cli-1.7.3 → das_cli-1.7.4}/das_cli.egg-info/dependency_links.txt +0 -0
- {das_cli-1.7.3 → das_cli-1.7.4}/das_cli.egg-info/entry_points.txt +0 -0
- {das_cli-1.7.3 → das_cli-1.7.4}/das_cli.egg-info/requires.txt +0 -0
- {das_cli-1.7.3 → das_cli-1.7.4}/das_cli.egg-info/top_level.txt +0 -0
- {das_cli-1.7.3 → das_cli-1.7.4}/setup.cfg +0 -0
|
@@ -8,13 +8,14 @@ from das.services.search import SearchService
|
|
|
8
8
|
from das.services.das_elastic_search import DasElasticSearch
|
|
9
9
|
from das.services.session import SessionService, pick
|
|
10
10
|
from das.common.config import (
|
|
11
|
-
save_api_url, load_api_url, save_token, set_auth_type, describe_credential,
|
|
11
|
+
save_api_url, load_api_url, normalize_api_url, save_token, set_auth_type, describe_credential,
|
|
12
12
|
)
|
|
13
13
|
|
|
14
14
|
# $env:PYTHONPATH="C:\Workspace\das-cli"
|
|
15
15
|
|
|
16
16
|
class Das:
|
|
17
17
|
def __init__(self, base_url: str = None):
|
|
18
|
+
base_url = normalize_api_url(base_url)
|
|
18
19
|
if base_url is None or base_url == "":
|
|
19
20
|
base_url = load_api_url()
|
|
20
21
|
if base_url is None or base_url == "":
|
|
@@ -4,7 +4,7 @@ import json
|
|
|
4
4
|
import os
|
|
5
5
|
from pathlib import Path
|
|
6
6
|
from das.common.config import (
|
|
7
|
-
save_api_url, load_api_url, DEFAULT_BASE_URL,
|
|
7
|
+
save_api_url, load_api_url, normalize_api_url, DEFAULT_BASE_URL,
|
|
8
8
|
save_verify_ssl, load_verify_ssl, VERIFY_SSL,
|
|
9
9
|
load_openai_api_key, save_openai_api_key, clear_openai_api_key,
|
|
10
10
|
clear_token, _config_dir,
|
|
@@ -158,6 +158,7 @@ def cli(ctx):
|
|
|
158
158
|
def login(das_ctx, api_url, username, password, use_oauth, api_key, skip_verify, debug):
|
|
159
159
|
"""Login and store authentication token"""
|
|
160
160
|
# Save API URL for future use
|
|
161
|
+
api_url = normalize_api_url(api_url)
|
|
161
162
|
save_api_url(api_url)
|
|
162
163
|
das_ctx.api_url = api_url
|
|
163
164
|
|
|
@@ -64,6 +64,13 @@ def _config_dir() -> Path:
|
|
|
64
64
|
|
|
65
65
|
CONFIG_FILE = _config_dir() / "config.json"
|
|
66
66
|
|
|
67
|
+
def normalize_api_url(api_url: Optional[str]) -> Optional[str]:
|
|
68
|
+
"""Strip whitespace and trailing slashes. Services append "/api/...", and a
|
|
69
|
+
"//api/..." URL makes the backend answer HTTP 200 with a non-JSON body."""
|
|
70
|
+
if api_url is None:
|
|
71
|
+
return None
|
|
72
|
+
return api_url.strip().rstrip("/") or None
|
|
73
|
+
|
|
67
74
|
def save_api_url(api_url: str) -> None:
|
|
68
75
|
config = {}
|
|
69
76
|
if CONFIG_FILE.exists():
|
|
@@ -71,16 +78,16 @@ def save_api_url(api_url: str) -> None:
|
|
|
71
78
|
config = json.loads(CONFIG_FILE.read_text(encoding="utf-8"))
|
|
72
79
|
except Exception:
|
|
73
80
|
config = {}
|
|
74
|
-
config["api_url"] = api_url
|
|
81
|
+
config["api_url"] = normalize_api_url(api_url)
|
|
75
82
|
CONFIG_FILE.write_text(json.dumps(config), encoding="utf-8")
|
|
76
83
|
|
|
77
84
|
def load_api_url() -> Optional[str]:
|
|
78
|
-
env_url = os.getenv("DAS_API_URL")
|
|
85
|
+
env_url = normalize_api_url(os.getenv("DAS_API_URL"))
|
|
79
86
|
if env_url:
|
|
80
87
|
return env_url
|
|
81
88
|
if CONFIG_FILE.exists():
|
|
82
89
|
try:
|
|
83
|
-
return json.loads(CONFIG_FILE.read_text(encoding="utf-8")).get("api_url")
|
|
90
|
+
return normalize_api_url(json.loads(CONFIG_FILE.read_text(encoding="utf-8")).get("api_url"))
|
|
84
91
|
except Exception:
|
|
85
92
|
return None
|
|
86
93
|
return None
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|