kscale 0.3.7__py3-none-any.whl → 0.3.8__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.
- kscale/__init__.py +1 -1
- kscale/cli.py +0 -2
- kscale/web/cli/robot_class.py +8 -1
- kscale/web/cli/user.py +1 -2
- kscale/web/clients/base.py +13 -2
- {kscale-0.3.7.dist-info → kscale-0.3.8.dist-info}/METADATA +1 -1
- {kscale-0.3.7.dist-info → kscale-0.3.8.dist-info}/RECORD +11 -12
- kscale/web/cli/token.py +0 -33
- {kscale-0.3.7.dist-info → kscale-0.3.8.dist-info}/LICENSE +0 -0
- {kscale-0.3.7.dist-info → kscale-0.3.8.dist-info}/WHEEL +0 -0
- {kscale-0.3.7.dist-info → kscale-0.3.8.dist-info}/entry_points.txt +0 -0
- {kscale-0.3.7.dist-info → kscale-0.3.8.dist-info}/top_level.txt +0 -0
kscale/__init__.py
CHANGED
kscale/cli.py
CHANGED
@@ -8,7 +8,6 @@ import colorlogging
|
|
8
8
|
from kscale.utils.cli import recursive_help
|
9
9
|
from kscale.web.cli.robot import cli as robot_cli
|
10
10
|
from kscale.web.cli.robot_class import cli as robot_class_cli
|
11
|
-
from kscale.web.cli.token import cli as token_cli
|
12
11
|
from kscale.web.cli.user import cli as user_cli
|
13
12
|
|
14
13
|
|
@@ -22,7 +21,6 @@ def cli() -> None:
|
|
22
21
|
logging.getLogger("aiohttp.access").setLevel(logging.WARNING)
|
23
22
|
|
24
23
|
|
25
|
-
cli.add_command(token_cli, "token")
|
26
24
|
cli.add_command(user_cli, "user")
|
27
25
|
cli.add_command(robot_class_cli, "robots")
|
28
26
|
cli.add_command(robot_cli, "robot")
|
kscale/web/cli/robot_class.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
"""Defines the CLI for getting information about robot classes."""
|
2
2
|
|
3
|
+
import itertools
|
3
4
|
import json
|
4
5
|
import logging
|
5
6
|
import math
|
@@ -464,7 +465,13 @@ async def run_mujoco(class_name: str, no_cache: bool) -> None:
|
|
464
465
|
extracted_folder = await client.download_and_extract_urdf(class_name, cache=not no_cache)
|
465
466
|
|
466
467
|
try:
|
467
|
-
mjcf_file = next(
|
468
|
+
mjcf_file = next(
|
469
|
+
itertools.chain(
|
470
|
+
extracted_folder.glob("*.scene.mjcf"),
|
471
|
+
extracted_folder.glob("*.mjcf"),
|
472
|
+
extracted_folder.glob("*.xml"),
|
473
|
+
)
|
474
|
+
)
|
468
475
|
except StopIteration:
|
469
476
|
click.echo(click.style(f"No MJCF file found in {extracted_folder}", fg="red"))
|
470
477
|
return
|
kscale/web/cli/user.py
CHANGED
@@ -45,8 +45,7 @@ async def key() -> None:
|
|
45
45
|
"""Get an API key for the currently-authenticated user."""
|
46
46
|
client = UserClient()
|
47
47
|
api_key = await client.get_api_key()
|
48
|
-
click.echo("API key:")
|
49
|
-
click.echo(click.style(api_key, fg="green"))
|
48
|
+
click.echo(f"API key: {click.style(api_key, fg='green')}")
|
50
49
|
|
51
50
|
|
52
51
|
if __name__ == "__main__":
|
kscale/web/clients/base.py
CHANGED
@@ -5,6 +5,7 @@ import json
|
|
5
5
|
import logging
|
6
6
|
import os
|
7
7
|
import secrets
|
8
|
+
import sys
|
8
9
|
import time
|
9
10
|
import webbrowser
|
10
11
|
from types import TracebackType
|
@@ -31,6 +32,10 @@ OAUTH_PORT = 16821
|
|
31
32
|
HEADER_NAME = "x-kscale-api-key"
|
32
33
|
|
33
34
|
|
35
|
+
def verbose_error() -> bool:
|
36
|
+
return os.environ.get("KSCALE_VERBOSE_ERROR", "0") == "1"
|
37
|
+
|
38
|
+
|
34
39
|
class OAuthCallback:
|
35
40
|
def __init__(self) -> None:
|
36
41
|
self.token_type: str | None = None
|
@@ -375,8 +380,14 @@ class BaseClient:
|
|
375
380
|
response = await client.request(method, url, **kwargs)
|
376
381
|
|
377
382
|
if response.is_error:
|
378
|
-
logger.error("
|
379
|
-
|
383
|
+
logger.error("Got %d error K-Scale: %s", response.status_code, response.text)
|
384
|
+
if verbose_error():
|
385
|
+
response.raise_for_status()
|
386
|
+
else:
|
387
|
+
logger.error("Use KSCALE_VERBOSE_ERROR=1 to see the full error message")
|
388
|
+
logger.error("If this persists, please create an issue here: https://github.com/kscalelabs/kscale")
|
389
|
+
sys.exit(1)
|
390
|
+
|
380
391
|
return response.json()
|
381
392
|
|
382
393
|
async def close(self) -> None:
|
@@ -1,5 +1,5 @@
|
|
1
|
-
kscale/__init__.py,sha256=
|
2
|
-
kscale/cli.py,sha256=
|
1
|
+
kscale/__init__.py,sha256=XbIxlxq1doXA2L5v8II07s5g2CoqvIRp8LT5AfdFJDY,200
|
2
|
+
kscale/cli.py,sha256=JvaPtmWvF7s0D4I3K98eZAItf3oOi2ULsn5aPGxDcu4,795
|
3
3
|
kscale/conf.py,sha256=dm35XSnzJp93St-ixVtYN4Nvqvb5upPGBrWkSI6Yb-4,1743
|
4
4
|
kscale/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
5
5
|
kscale/requirements-dev.txt,sha256=WI7-ea4IRJakmqVMN8QKhOsDGrghwtvk03aIsFaNSIw,130
|
@@ -15,20 +15,19 @@ kscale/web/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
15
15
|
kscale/web/utils.py,sha256=Mme-FAQ0_zbjjOQeX8wyq8F4kL4i9fH7ytri16U6qOA,1046
|
16
16
|
kscale/web/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
17
17
|
kscale/web/cli/robot.py,sha256=rI-A4_0uvJPeA71Apl4Z3mV5fIfWkgmzT9JRmJYxz3A,3307
|
18
|
-
kscale/web/cli/robot_class.py,sha256=
|
19
|
-
kscale/web/cli/
|
20
|
-
kscale/web/cli/user.py,sha256=aaJJCL1P5lfhK6ZC9OwOHXKA-I3MWqVZ_k7TYnx33CY,1303
|
18
|
+
kscale/web/cli/robot_class.py,sha256=Vg-KWROdmz3yqBEG-RS5xiUviKwEz8DZ3q2estK66ZQ,19082
|
19
|
+
kscale/web/cli/user.py,sha256=9IGsJBPyhjsmT04mZ2RGOs35ePfqB2RltYP0Ty5zF5o,1290
|
21
20
|
kscale/web/clients/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
22
|
-
kscale/web/clients/base.py,sha256=
|
21
|
+
kscale/web/clients/base.py,sha256=ThQakuvGh7CquiGQ4wiCyCWAgqmKInsJcANo910X9Uw,15585
|
23
22
|
kscale/web/clients/client.py,sha256=rzW2s8T7bKVuybOSQ65-ghl02rcXBoOxnx_nUDwgEPw,362
|
24
23
|
kscale/web/clients/robot.py,sha256=PI8HHkU-4Re9I5rLpp6dGbekRE-rBNVfXZxR_mO2MqE,1485
|
25
24
|
kscale/web/clients/robot_class.py,sha256=G8Nk6V7LGJE9Wpg9tyyCkIfz1fRTsxXQRgHtleiUVqo,6834
|
26
25
|
kscale/web/clients/user.py,sha256=jsa1_s6qXRM-AGBbHlPhd1NierUtynjY9tVAPNr6_Os,568
|
27
26
|
kscale/web/gen/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
28
27
|
kscale/web/gen/api.py,sha256=VWlt8TaMZaAhCPPIWhx1d4yE0BRfpVz0-_Cps8hjgAI,4662
|
29
|
-
kscale-0.3.
|
30
|
-
kscale-0.3.
|
31
|
-
kscale-0.3.
|
32
|
-
kscale-0.3.
|
33
|
-
kscale-0.3.
|
34
|
-
kscale-0.3.
|
28
|
+
kscale-0.3.8.dist-info/LICENSE,sha256=HCN2bImAzUOXldAZZI7JZ9PYq6OwMlDAP_PpX1HnuN0,1071
|
29
|
+
kscale-0.3.8.dist-info/METADATA,sha256=b2ThYIovV2vTrR_uU44Hl4VHWKZEJkNJa56_1VqyvrE,2320
|
30
|
+
kscale-0.3.8.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
31
|
+
kscale-0.3.8.dist-info/entry_points.txt,sha256=N_0pCpPnwGDYVzOeuaSOrbJkS5L3lS9d8CxpJF1f8UI,62
|
32
|
+
kscale-0.3.8.dist-info/top_level.txt,sha256=C2ynjYwopg6YjgttnI2dJjasyq3EKNmYp-IfQg9Xms4,7
|
33
|
+
kscale-0.3.8.dist-info/RECORD,,
|
kscale/web/cli/token.py
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
"""Defines the CLI for interacting with K-Scale's OpenID Connect server."""
|
2
|
-
|
3
|
-
import logging
|
4
|
-
|
5
|
-
import click
|
6
|
-
|
7
|
-
from kscale.utils.cli import coro
|
8
|
-
from kscale.web.clients.base import BaseClient
|
9
|
-
|
10
|
-
logger = logging.getLogger(__name__)
|
11
|
-
|
12
|
-
|
13
|
-
@click.group()
|
14
|
-
def cli() -> None:
|
15
|
-
"""Retrieve an OICD token from the K-Scale authentication server."""
|
16
|
-
pass
|
17
|
-
|
18
|
-
|
19
|
-
@cli.command()
|
20
|
-
@coro
|
21
|
-
async def get() -> None:
|
22
|
-
"""Get a bearer token from OpenID Connect."""
|
23
|
-
logging.getLogger("aiohttp.access").setLevel(logging.WARNING)
|
24
|
-
async with BaseClient() as client:
|
25
|
-
try:
|
26
|
-
token = await client.get_bearer_token()
|
27
|
-
logger.info("Bearer token: %s", token)
|
28
|
-
except Exception:
|
29
|
-
logger.exception("Error getting bearer token")
|
30
|
-
|
31
|
-
|
32
|
-
if __name__ == "__main__":
|
33
|
-
cli()
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|