remotivelabs-cli 0.0.29__py3-none-any.whl → 0.0.30__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.
cli/cloud/recordings.py CHANGED
@@ -58,7 +58,9 @@ def list_recordings(
58
58
  """
59
59
 
60
60
  if is_processing:
61
- Rest.handle_get(f"/api/project/{project}/files/recording/processing")
61
+ res = Rest.handle_get(f"/api/project/{project}/files/recording/processing", return_response=True)
62
+ json_res: List[Dict[str, Any]] = res.json()
63
+ print(json.dumps(list(filter(lambda r: r["status"] == "RUNNING" or r["status"] == "FAILED", json_res))))
62
64
  else:
63
65
  Rest.handle_get(f"/api/project/{project}/files/recording")
64
66
 
@@ -79,7 +81,44 @@ def describe(
79
81
  # body=json.dumps({'projectUid': target_project}))
80
82
 
81
83
 
82
- def do_start(name: str, project: str, api_key: str, return_response: bool = False) -> requests.Response | None:
84
+ @app.command(name="import")
85
+ def import_as_recording(
86
+ project: str = typer.Option(..., help="Project ID", envvar="REMOTIVE_CLOUD_PROJECT"),
87
+ path: str = typer.Argument(default=..., help="Remote storage path to file to delete"),
88
+ ) -> None:
89
+ """
90
+ Imports a file from Storage as a recording.
91
+ NOTE that Storage is not yet available to all customers
92
+ """
93
+
94
+ if path.startswith("rcs://"):
95
+ final_path = __check_rcs_path(path)
96
+ else:
97
+ ErrorPrinter.print_hint("Path must start with rcs://")
98
+ sys.exit(1)
99
+
100
+ Rest.handle_post(
101
+ url=f"/api/project/{project}/files/recording",
102
+ return_response=True,
103
+ progress_label=f"Importing {final_path}...",
104
+ body=json.dumps({"path": final_path}),
105
+ )
106
+
107
+ ErrorPrinter.print_hint(
108
+ f"Import started, you can track progress with 'remotive cloud recordings list --is-processing --project {project}'"
109
+ )
110
+
111
+
112
+ # Copied from filestorage
113
+ def __check_rcs_path(path: str) -> str:
114
+ rcs_path = path.replace("rcs://", "/")
115
+ if rcs_path.startswith("/."):
116
+ ErrorPrinter.print_hint("Invalid path")
117
+ sys.exit(1)
118
+ return rcs_path
119
+
120
+
121
+ def do_start(name: str, project: str, api_key: str, return_response: bool = False) -> requests.Response:
83
122
  if api_key == "":
84
123
  body = {"size": "S"}
85
124
  else:
@@ -125,13 +164,10 @@ def mount( # noqa: C901
125
164
  else:
126
165
  r = Rest.handle_get(url=f"/api/project/{project}/brokers/{broker}", return_response=True, allow_status_codes=[404])
127
166
 
128
- if r is None:
129
- sys.exit(1)
130
167
  if r.status_code == 404:
131
168
  if ensure_broker_started:
132
169
  r = do_start(broker, project, "", return_response=True)
133
- if r is None:
134
- sys.exit(1)
170
+
135
171
  if r.status_code != 200:
136
172
  print(r.text)
137
173
  sys.exit(1)
cli/cloud/rest_helper.py CHANGED
@@ -102,7 +102,7 @@ class RestHelper:
102
102
  progress_label: str = "Fetching...",
103
103
  use_progress_indicator: bool = True,
104
104
  timeout: int = 20,
105
- ) -> requests.Response | None:
105
+ ) -> requests.Response:
106
106
  # pylint: disable=R0913
107
107
  # Returns a Response object if succesfull otherwise None
108
108
  if params is None:
@@ -118,7 +118,7 @@ class RestHelper:
118
118
  RestHelper.check_api_result(r, allow_status_codes)
119
119
  return r
120
120
  RestHelper.print_api_result(r)
121
- return requests.Response()
121
+ sys.exit(0)
122
122
 
123
123
  @staticmethod
124
124
  def has_access(url: str, params: Any = {}) -> bool: # pylint: disable=W0102
@@ -174,7 +174,7 @@ class RestHelper:
174
174
  @staticmethod
175
175
  def handle_post( # pylint: disable=W0102
176
176
  url: str, body: Any = None, params: Any = {}, progress_label: str = "Processing...", return_response: bool = False
177
- ) -> requests.Response | None:
177
+ ) -> requests.Response:
178
178
  # Returns a Response object if succesfull otherwise, None
179
179
  RestHelper.ensure_auth_token()
180
180
  RestHelper.__headers["content-type"] = "application/json"
@@ -187,7 +187,7 @@ class RestHelper:
187
187
  return r
188
188
 
189
189
  RestHelper.print_api_result(r)
190
- return None
190
+ sys.exit(0)
191
191
 
192
192
  @staticmethod
193
193
  def handle_put(url: str, body: Any = None, params: Any = {}, return_response: bool = False) -> requests.Response | None: # pylint: disable=W0102
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: remotivelabs-cli
3
- Version: 0.0.29
3
+ Version: 0.0.30
4
4
  Summary: CLI for operating RemotiveCloud and RemotiveBroker
5
5
  Author: Johan Rask
6
6
  Author-email: johan.rask@remotivelabs.com
@@ -19,9 +19,9 @@ cli/cloud/configs.py,sha256=xg3J-kaS-Pp0p9otV2cWl_oOWJzs_jZhXwFHz0gQxvc,4625
19
19
  cli/cloud/filestorage.py,sha256=cCPDYwCyJxP4V_qK1_Gnsg_T-zVsw6QaZdY_l4s4vC0,5445
20
20
  cli/cloud/organisations.py,sha256=txKQmSQEpTmeqlqngai8pwgQQEvRgeDd0dT_VzZ7RNc,752
21
21
  cli/cloud/projects.py,sha256=YrwPJClC2Sq_y1HjPd_tzaiv4GEnnsXSXHBhtQCPdK0,1431
22
- cli/cloud/recordings.py,sha256=jnsc39CmIQQ3DUu5Mpe7wrr6aLCK870TRi6TcgGmiY0,24137
22
+ cli/cloud/recordings.py,sha256=jai5Gim28UmZFGniUI9qKDwtLoi2Nllv4eyPeIk3OAc,25366
23
23
  cli/cloud/recordings_playback.py,sha256=PRzftmvG2iePrL9f6qTEXVOnyJ-etcyzn5w9CCxcSto,11539
24
- cli/cloud/rest_helper.py,sha256=8XgqmxoeW8zM0tYWNAn7rABJdvgJFYfy0adOo66kys4,11499
24
+ cli/cloud/rest_helper.py,sha256=lZp0NjQ8yOaggQGNiqNxHex_YFOmuq0rnLPtpLq3Z3Q,11470
25
25
  cli/cloud/resumable_upload.py,sha256=sYThyhseXRniOMbctbO5p4BGVb9b7BXVBcmcZXwnClM,3550
26
26
  cli/cloud/sample_recordings.py,sha256=OVX32U1dkkkJZysbgr5Dy515oOQKnwBAbZYzV_QUu1g,690
27
27
  cli/cloud/service_account_tokens.py,sha256=263u1bRmBKfYsxL6TV6YjReUBUaVHWc3ETCd7AS3DTU,2297
@@ -36,8 +36,8 @@ cli/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
36
36
  cli/tools/can/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
37
37
  cli/tools/can/can.py,sha256=8uATViSFlpkdSiIm4fzbuQi1_m7V9Pym-K17TaJQRHU,2262
38
38
  cli/tools/tools.py,sha256=0KU-hXR1f9xHP4BOG9A9eXfmICLmNuQCOU8ueF6iGg0,198
39
- remotivelabs_cli-0.0.29.dist-info/LICENSE,sha256=qDPP_yfuv1fF-u7EfexN-cN3M8aFgGVndGhGLovLKz0,608
40
- remotivelabs_cli-0.0.29.dist-info/METADATA,sha256=72C3NkomgtEga_Fwr-zzm-N-93nYvflrGr51ulAuh4Q,1318
41
- remotivelabs_cli-0.0.29.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
42
- remotivelabs_cli-0.0.29.dist-info/entry_points.txt,sha256=lvDhPgagLqW_KTnLPCwKSqfYlEp-1uYVosRiPjsVj10,45
43
- remotivelabs_cli-0.0.29.dist-info/RECORD,,
39
+ remotivelabs_cli-0.0.30.dist-info/LICENSE,sha256=qDPP_yfuv1fF-u7EfexN-cN3M8aFgGVndGhGLovLKz0,608
40
+ remotivelabs_cli-0.0.30.dist-info/METADATA,sha256=82x7il8xKpkWGgoxjahiE9bW3QBSiPC--YuUG2d-Prs,1318
41
+ remotivelabs_cli-0.0.30.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
42
+ remotivelabs_cli-0.0.30.dist-info/entry_points.txt,sha256=lvDhPgagLqW_KTnLPCwKSqfYlEp-1uYVosRiPjsVj10,45
43
+ remotivelabs_cli-0.0.30.dist-info/RECORD,,