sima-cli 0.0.31__py3-none-any.whl → 0.0.32__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.
sima_cli/__version__.py CHANGED
@@ -1,2 +1,2 @@
1
1
  # sima_cli/__version__.py
2
- __version__ = "0.0.31"
2
+ __version__ = "0.0.32"
@@ -3,7 +3,10 @@ import click
3
3
  import getpass
4
4
  import requests
5
5
  import json
6
+ import tempfile
7
+
6
8
  from http.cookiejar import MozillaCookieJar
9
+ from sima_cli.__version__ import __version__
7
10
 
8
11
  HOME_DIR = os.path.expanduser("~/.sima-cli")
9
12
  COOKIE_JAR_PATH = os.path.join(HOME_DIR, ".sima-cli-cookies.txt")
@@ -11,10 +14,10 @@ CSRF_PATH = os.path.join(HOME_DIR, ".sima-cli-csrf.json")
11
14
 
12
15
  CSRF_URL = "https://developer.sima.ai/session/csrf"
13
16
  LOGIN_URL = "https://developer.sima.ai/session"
14
- DUMMY_CHECK_URL = "https://docs.sima.ai/pkg_downloads/dummy"
17
+ DUMMY_CHECK_URL = "https://docs.sima.ai/pkg_downloads/validation"
15
18
 
16
19
  HEADERS = {
17
- "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36",
20
+ "User-Agent": f"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) sima-cli/{__version__} Chrome/137.0.0.0 Safari/537.36",
18
21
  "X-Requested-With": "XMLHttpRequest",
19
22
  "Referer": "https://developer.sima.ai/login",
20
23
  "Origin": "https://developer.sima.ai",
@@ -24,12 +27,36 @@ HEADERS = {
24
27
  "sec-ch-ua-platform": '"macOS"',
25
28
  }
26
29
 
30
+ def _handle_eula_flow(session: requests.Session, username: str, domain: str) -> bool:
31
+ try:
32
+ click.echo("\n📄 To continue, you must accept the End-User License Agreement (EULA).")
33
+ click.echo("👉 Please sign in to Developer Portal on your browser, then open the following URL to accept the EULA:")
34
+ click.echo(f"\n {DUMMY_CHECK_URL}\n")
35
+
36
+ if not click.confirm("✅ Have you completed the EULA form in your browser?", default=True):
37
+ click.echo("❌ EULA acceptance is required to continue.")
38
+ return False
39
+
40
+ return True
41
+
42
+ except Exception as e:
43
+ click.echo(f"❌ Error during EULA flow: {e}")
44
+ return False
27
45
 
28
46
  def _is_session_valid(session: requests.Session) -> bool:
29
47
  try:
30
48
  response = session.get(DUMMY_CHECK_URL, allow_redirects=False)
31
- return response.status_code == 200
32
- except Exception:
49
+
50
+ if response.status_code == 200:
51
+ return True
52
+ elif response.status_code == 302:
53
+ location = response.headers.get("Location", "")
54
+ if "show-eula-form=1" in location:
55
+ return _handle_eula_flow(session, username="", domain="")
56
+
57
+ return False
58
+ except Exception as e:
59
+ click.echo(f"❌ Error validating session: {e}")
33
60
  return False
34
61
 
35
62
  def _delete_auth_files():
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sima-cli
3
- Version: 0.0.31
3
+ Version: 0.0.32
4
4
  Summary: CLI tool for SiMa Developer Portal to download models, firmware, and apps.
5
5
  Home-page: https://developer.sima.ai/
6
6
  Author: SiMa.ai
@@ -1,11 +1,11 @@
1
1
  sima_cli/__init__.py,sha256=Nb2jSg9-CX1XvSc1c21U9qQ3atINxphuNkNfmR-9P3o,332
2
2
  sima_cli/__main__.py,sha256=ehzD6AZ7zGytC2gLSvaJatxeD0jJdaEvNJvwYeGsWOg,69
3
- sima_cli/__version__.py,sha256=5Ig2ah-U3Zaaf5Y1Kp0steH9WKPAxGvzGGgVTVSg_tY,49
3
+ sima_cli/__version__.py,sha256=GQtUV16wGw39emS7dJUNBY68tz0z4U8p69F7t8QwZ24,49
4
4
  sima_cli/cli.py,sha256=uCZ-9mKBGyGtfx3p97WZkdMjXL2KJlqihfZm8VsWiqw,17220
5
5
  sima_cli/app_zoo/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
6
  sima_cli/app_zoo/app.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
7
  sima_cli/auth/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
- sima_cli/auth/basic_auth.py,sha256=mEmPrj32TVu1s34xR_UrJlIKHA3xBh98i_FzIZvAWag,7364
8
+ sima_cli/auth/basic_auth.py,sha256=rJwxRoZSN5bt_v8-IFZHsRp4YHfxogFvU_M6wAp229k,8473
9
9
  sima_cli/auth/login.py,sha256=yCYXWgrfbP4jSTZ3hITfxlgHkdVQVzsd8hQKpqaqCKs,3780
10
10
  sima_cli/data/resources_internal.yaml,sha256=zlQD4cSnZK86bLtTWuvEudZTARKiuIKmB--Jv4ajL8o,200
11
11
  sima_cli/data/resources_public.yaml,sha256=U7hmUomGeQ2ULdo1BU2OQHr0PyKBamIdK9qrutDlX8o,201
@@ -46,7 +46,7 @@ sima_cli/utils/env.py,sha256=IP5HrH0lE7RMSiBeXcEt5GCLMT5p-QQroG-uGzl5XFU,8181
46
46
  sima_cli/utils/net.py,sha256=WVntA4CqipkNrrkA4tBVRadJft_pMcGYh4Re5xk3rqo,971
47
47
  sima_cli/utils/network.py,sha256=UvqxbqbWUczGFyO-t1SybG7Q-x9kjUVRNIn_D6APzy8,1252
48
48
  sima_cli/utils/pkg_update_check.py,sha256=IAV_NAOsBDL_lYNYMRYfdZWuVq-rJ_zzHjJJZ7UQaoc,3274
49
- sima_cli-0.0.31.dist-info/licenses/LICENSE,sha256=a260OFuV4SsMZ6sQCkoYbtws_4o2deFtbnT9kg7Rfd4,1082
49
+ sima_cli-0.0.32.dist-info/licenses/LICENSE,sha256=a260OFuV4SsMZ6sQCkoYbtws_4o2deFtbnT9kg7Rfd4,1082
50
50
  tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
51
51
  tests/test_app_zoo.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
52
52
  tests/test_auth.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -55,8 +55,8 @@ tests/test_download.py,sha256=t87DwxlHs26_ws9rpcHGwr_OrcRPd3hz6Zmm0vRee2U,4465
55
55
  tests/test_firmware.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
56
56
  tests/test_model_zoo.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
57
57
  tests/test_utils.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
58
- sima_cli-0.0.31.dist-info/METADATA,sha256=Q18Y7rOEEqe3ejP7IMqt5H6F3KipuWjUk15o_UwSIpg,3705
59
- sima_cli-0.0.31.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
60
- sima_cli-0.0.31.dist-info/entry_points.txt,sha256=xRYrDq1nCs6R8wEdB3c1kKuimxEjWJkHuCzArQPT0Xk,47
61
- sima_cli-0.0.31.dist-info/top_level.txt,sha256=FtrbAUdHNohtEPteOblArxQNwoX9_t8qJQd59fagDlc,15
62
- sima_cli-0.0.31.dist-info/RECORD,,
58
+ sima_cli-0.0.32.dist-info/METADATA,sha256=U2WSNDVfQWPqZjPVGrSJKkSUeKHzY8cOs59vAgGq2UI,3705
59
+ sima_cli-0.0.32.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
60
+ sima_cli-0.0.32.dist-info/entry_points.txt,sha256=xRYrDq1nCs6R8wEdB3c1kKuimxEjWJkHuCzArQPT0Xk,47
61
+ sima_cli-0.0.32.dist-info/top_level.txt,sha256=FtrbAUdHNohtEPteOblArxQNwoX9_t8qJQd59fagDlc,15
62
+ sima_cli-0.0.32.dist-info/RECORD,,