kscale 0.1.4__py3-none-any.whl → 0.2.0__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- kscale/__init__.py +1 -1
- kscale/conf.py +1 -1
- kscale/web/clients/base.py +12 -0
- kscale/web/clients/robot_class.py +0 -5
- kscale/web/utils.py +1 -1
- {kscale-0.1.4.dist-info → kscale-0.2.0.dist-info}/METADATA +1 -1
- {kscale-0.1.4.dist-info → kscale-0.2.0.dist-info}/RECORD +11 -11
- {kscale-0.1.4.dist-info → kscale-0.2.0.dist-info}/LICENSE +0 -0
- {kscale-0.1.4.dist-info → kscale-0.2.0.dist-info}/WHEEL +0 -0
- {kscale-0.1.4.dist-info → kscale-0.2.0.dist-info}/entry_points.txt +0 -0
- {kscale-0.1.4.dist-info → kscale-0.2.0.dist-info}/top_level.txt +0 -0
kscale/__init__.py
CHANGED
kscale/conf.py
CHANGED
@@ -21,7 +21,7 @@ def get_path() -> Path:
|
|
21
21
|
@dataclass
|
22
22
|
class WWWSettings:
|
23
23
|
api_root: str = field(default=DEFAULT_API_ROOT)
|
24
|
-
|
24
|
+
base_dir: str = field(default=II("oc.env:KSCALE_DIR,'~/.kscale/'"))
|
25
25
|
refresh_interval_minutes: int = field(default=60 * 24)
|
26
26
|
|
27
27
|
|
kscale/web/clients/base.py
CHANGED
@@ -206,6 +206,18 @@ class BaseClient:
|
|
206
206
|
Returns:
|
207
207
|
A bearer token to use with the K-Scale WWW API.
|
208
208
|
"""
|
209
|
+
# Check if we are in a headless environment.
|
210
|
+
error_message = (
|
211
|
+
"Cannot perform browser-based authentication in a headless environment. "
|
212
|
+
"Please use 'kscale user key' to generate an API key locally and set "
|
213
|
+
"the KSCALE_API_KEY environment variable instead."
|
214
|
+
)
|
215
|
+
try:
|
216
|
+
if not webbrowser.get().name != "null":
|
217
|
+
raise RuntimeError(error_message)
|
218
|
+
except webbrowser.Error:
|
219
|
+
raise RuntimeError(error_message)
|
220
|
+
|
209
221
|
oicd_info = await self._get_oicd_info()
|
210
222
|
metadata = await self._get_oicd_metadata()
|
211
223
|
auth_endpoint = metadata["authorization_endpoint"]
|
@@ -3,7 +3,6 @@
|
|
3
3
|
import hashlib
|
4
4
|
import json
|
5
5
|
import logging
|
6
|
-
import tarfile
|
7
6
|
from pathlib import Path
|
8
7
|
|
9
8
|
import httpx
|
@@ -133,10 +132,6 @@ class RobotClassClient(BaseClient):
|
|
133
132
|
if hash_value_hex != expected_hash:
|
134
133
|
raise ValueError(f"MD5 hash mismatch: {hash_value_hex} != {expected_hash}")
|
135
134
|
|
136
|
-
logger.info("Unpacking downloaded file")
|
137
|
-
with tarfile.open(cache_path, "r:gz") as tar:
|
138
|
-
tar.extractall(path=cache_path.parent)
|
139
|
-
|
140
135
|
logger.info("Updating downloaded file information")
|
141
136
|
info = {"md5_hash": hash_value_hex}
|
142
137
|
with open(cache_path_info, "w") as f:
|
kscale/web/utils.py
CHANGED
@@ -15,7 +15,7 @@ DEFAULT_UPLOAD_TIMEOUT = 300.0 # 5 minutes
|
|
15
15
|
@functools.lru_cache
|
16
16
|
def get_kscale_dir() -> Path:
|
17
17
|
"""Returns the cache directory for artifacts."""
|
18
|
-
return Path(Settings.load().www.
|
18
|
+
return Path(Settings.load().www.base_dir).expanduser().resolve()
|
19
19
|
|
20
20
|
|
21
21
|
def get_auth_dir() -> Path:
|
@@ -1,7 +1,7 @@
|
|
1
|
-
kscale/__init__.py,sha256=
|
1
|
+
kscale/__init__.py,sha256=90mHt8ZJkKMXl-CpnjHf369fws_cliOlAc0Y_SNrvS8,172
|
2
2
|
kscale/api.py,sha256=jmiuFurTN_Gj_-k-6asqxw8wp-_bgJUXgMPFgJ4lqHA,230
|
3
3
|
kscale/cli.py,sha256=PMHLKR5UwdbbReVmqHXpJ-K9-mGHv_0I7KQkwxmFcUA,881
|
4
|
-
kscale/conf.py,sha256=
|
4
|
+
kscale/conf.py,sha256=OLGz2J-9NAaICoWeN9-hCxrOsyf0vpJBNw-UzIsHdwE,1572
|
5
5
|
kscale/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
6
6
|
kscale/requirements-dev.txt,sha256=WI7-ea4IRJakmqVMN8QKhOsDGrghwtvk03aIsFaNSIw,130
|
7
7
|
kscale/requirements.txt,sha256=_BGbnKTQaXKx0bNEG0wguod9swsiCb2mF6rLm7sFJ2Q,214
|
@@ -14,23 +14,23 @@ kscale/utils/checksum.py,sha256=jt6QmmQND9zrOEnUtOfZpLYROhgto4Gh3OpdUWk4tZA,1093
|
|
14
14
|
kscale/utils/cli.py,sha256=JoaY5x5SdUx97KmMM9j5AjRRUqqrTlJ9qVckZptEsYA,827
|
15
15
|
kscale/web/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
16
16
|
kscale/web/api.py,sha256=oyW0XLfX96RPe1xNgdf8ejfATdLlNlP0CL1lP0FN1nM,593
|
17
|
-
kscale/web/utils.py,sha256=
|
17
|
+
kscale/web/utils.py,sha256=Mme-FAQ0_zbjjOQeX8wyq8F4kL4i9fH7ytri16U6qOA,1046
|
18
18
|
kscale/web/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
19
19
|
kscale/web/cli/robot.py,sha256=rI-A4_0uvJPeA71Apl4Z3mV5fIfWkgmzT9JRmJYxz3A,3307
|
20
20
|
kscale/web/cli/robot_class.py,sha256=ymC5phUqofvOXv5P6f51b9lMK5eRDaavvnzS0x9rDbU,3574
|
21
21
|
kscale/web/cli/token.py,sha256=1rFC8MYKtqbNsQa2KIqwW1tqpaMtFaxuNsallwejXTU,787
|
22
22
|
kscale/web/cli/user.py,sha256=aaJJCL1P5lfhK6ZC9OwOHXKA-I3MWqVZ_k7TYnx33CY,1303
|
23
23
|
kscale/web/clients/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
24
|
-
kscale/web/clients/base.py,sha256=
|
24
|
+
kscale/web/clients/base.py,sha256=uovIxtkotRxrIFL0PhLYDIhhfXrIGjXxNY2FLVO3L18,15110
|
25
25
|
kscale/web/clients/client.py,sha256=QjBicdHQYNoUG9XRjAYmGu3THae9DzWa_hQox3OO1Gw,214
|
26
26
|
kscale/web/clients/robot.py,sha256=HMfJnkDxaJ_o7X2vdYYS9iob1JRoBG2qiGmQpCQZpAk,1485
|
27
|
-
kscale/web/clients/robot_class.py,sha256=
|
27
|
+
kscale/web/clients/robot_class.py,sha256=KnfGUNyaXsnhDODp3KdMOkpydptKbOtmVn-W6Eta-Q0,5036
|
28
28
|
kscale/web/clients/user.py,sha256=jsa1_s6qXRM-AGBbHlPhd1NierUtynjY9tVAPNr6_Os,568
|
29
29
|
kscale/web/gen/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
30
30
|
kscale/web/gen/api.py,sha256=SovcII36JFgK9jd2CXlLPMjiUROGB4vEnapOsYMUrkU,2188
|
31
|
-
kscale-0.
|
32
|
-
kscale-0.
|
33
|
-
kscale-0.
|
34
|
-
kscale-0.
|
35
|
-
kscale-0.
|
36
|
-
kscale-0.
|
31
|
+
kscale-0.2.0.dist-info/LICENSE,sha256=HCN2bImAzUOXldAZZI7JZ9PYq6OwMlDAP_PpX1HnuN0,1071
|
32
|
+
kscale-0.2.0.dist-info/METADATA,sha256=6IsGyUFUz4LwuYhNeyaD86X6KlcoFkGq_zbrFiRXdLE,2340
|
33
|
+
kscale-0.2.0.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
34
|
+
kscale-0.2.0.dist-info/entry_points.txt,sha256=N_0pCpPnwGDYVzOeuaSOrbJkS5L3lS9d8CxpJF1f8UI,62
|
35
|
+
kscale-0.2.0.dist-info/top_level.txt,sha256=C2ynjYwopg6YjgttnI2dJjasyq3EKNmYp-IfQg9Xms4,7
|
36
|
+
kscale-0.2.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|