bosdyn-orbit 4.1.1__py3-none-any.whl → 5.0.1__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.
bosdyn/orbit/client.py CHANGED
@@ -6,6 +6,7 @@
6
6
 
7
7
  """ The client uses a web API to send HTTPs requests to a number of REStful endpoints using the Requests library.
8
8
  """
9
+ import warnings
9
10
  from typing import Dict, Iterable
10
11
 
11
12
  import requests
@@ -231,7 +232,7 @@ class Client():
231
232
  Returns:
232
233
  requests.Response: the response associated with the get request
233
234
  """
234
- return self.get_resource(f"site_walks/archive", params={"uuids": uuid}, **kwargs)
235
+ return self.get_resource("site_walks/archive", params={"uuids": uuid}, **kwargs)
235
236
 
236
237
  def get_site_elements(self, **kwargs) -> requests.Response:
237
238
  """ Returns site elements on the specified instance.
@@ -381,6 +382,17 @@ class Client():
381
382
  """
382
383
  return self.get_resource(f'runs/{uuid}', **kwargs)
383
384
 
385
+ def get_run_log(self, uuid: str, **kwargs) -> requests.Response:
386
+ """ Retrieves the log of a run.
387
+
388
+ Args:
389
+ uuid: the ID of the run.
390
+ kwargs(**): a variable number of keyword arguments for the get request.
391
+ Returns:
392
+ requests.Response: the response associated with the get request.
393
+ """
394
+ return self.get_resource(f'runs/{uuid}/log', **kwargs)
395
+
384
396
  def get_run_archives_by_id(self, uuid: str, **kwargs) -> requests.Response:
385
397
  """ Given a runUuid, returns run archives.
386
398
 
@@ -472,6 +484,67 @@ class Client():
472
484
  """
473
485
  return self.get_resource(f'robot-session/{robot_nickname}/session', **kwargs)
474
486
 
487
+ def get_anomalies(self, **kwargs) -> requests.Response:
488
+ """ Given a dictionary of query params, returns anomalies.
489
+
490
+ Args:
491
+ kwargs(**): a variable number of keyword arguments for the get request.
492
+ Raises:
493
+ RequestExceptions: exceptions thrown by the Requests library.
494
+ UnauthenticatedClientError: indicates that the client is not authenticated properly.
495
+ Returns:
496
+ requests.Response: the response associated with the get request.
497
+ """
498
+ return self.get_resource("anomalies", **kwargs)
499
+
500
+ def get_backup(self, task_id: str, **kwargs):
501
+ """ Retrieves a *.zip containing an Orbit backup.
502
+
503
+ Args:
504
+ task_id: the task ID returned from the post_backup_task method.
505
+ kwargs(**): a variable number of keyword arguments for the get request.
506
+ Raises:
507
+ RequestExceptions: exceptions thrown by the Requests library.
508
+ UnauthenticatedClientError: indicates that the client is not authenticated properly.
509
+ Returns:
510
+ requests.Response: the response associated with the get request.
511
+ """
512
+ return self.get_resource(f'backups/{task_id}', headers=OCTET_HEADER, **kwargs)
513
+
514
+ def get_backup_task(self, task_id: str, **kwargs):
515
+ """ Retrieves the status of a backup task started by the post_backup_task method.
516
+
517
+ Args:
518
+ task_id: the task ID returned from the post_backup_task method.
519
+ kwargs(**): a variable number of keyword arguments for the get request.
520
+ Raises:
521
+ RequestExceptions: exceptions thrown by the Requests library.
522
+ UnauthenticatedClientError: indicates that the client is not authenticated properly.
523
+ Returns:
524
+ requests.Response: the response associated with the get request.
525
+ """
526
+ return self.get_resource(f'backup_tasks/{task_id}', **kwargs)
527
+
528
+ def get_run_statistics(self, **kwargs) -> requests.Response:
529
+ """ Retrieves session statistics.
530
+
531
+ Args:
532
+ kwargs(**): a variable number of keyword arguments for the get request.
533
+ Returns:
534
+ requests.Response: the response associated with the get request.
535
+ """
536
+ return self.get_resource("run_statistics/sessions", **kwargs)
537
+
538
+ def get_run_statistics_session_summary(self, **kwargs) -> requests.Response:
539
+ """ Retrieves session summary.
540
+
541
+ Args:
542
+ kwargs(**): a variable number of keyword arguments for the get request.
543
+ Returns:
544
+ requests.Response: the response associated with the get request.
545
+ """
546
+ return self.get_resource("run_statistics/sessions_summary", **kwargs)
547
+
475
548
  def post_export_as_walk(self, site_walk_uuid: str, **kwargs) -> requests.Response:
476
549
  """ Given a SiteWalk uuid, it exports the walks_pb2.Walk equivalent.
477
550
 
@@ -484,7 +557,7 @@ class Client():
484
557
  Returns:
485
558
  requests.Response: The response associated with the post request.
486
559
  """
487
- return self.post_resource(f'site_walks/export_as_walk',
560
+ return self.post_resource('site_walks/export_as_walk',
488
561
  json={"siteWalkUuid": site_walk_uuid}, **kwargs)
489
562
 
490
563
  def post_import_from_walk(self, **kwargs) -> requests.Response:
@@ -720,26 +793,51 @@ class Client():
720
793
  "siteDockUuid": site_dock_uuid
721
794
  }, **kwargs)
722
795
 
723
- def post_dispatch_mission_to_robot(self, robot_nickname: str, driver_id: str, mission_uuid: str,
724
- delete_mission: bool, force_acquire_estop: bool,
725
- skip_initialization: bool, **kwargs) -> requests.Response:
796
+ def post_dispatch_mission_to_robot(self, robot_nickname: str, driver_id: str,
797
+ mission_uuid: str = None, delete_mission: bool = False,
798
+ force_acquire_estop: bool = False,
799
+ skip_initialization: bool = True, walk=None,
800
+ **kwargs) -> requests.Response:
726
801
  """ Dispatch the robot to a mission given a mission uuid.
727
802
 
728
803
  Args:
729
804
  robot_nickname: the nickname of the robot.
730
805
  driver_id: the current driver ID of the mission.
731
- mission_uuid: uuid of the mission(also known as SiteWalk) to dispatch.
732
- delete_mission: whether to delete the mission after playback.
806
+ mission_uuid: Deprecated. Use 'walk' instead.
807
+ delete_mission: DEPRECATED and no longer supported. Instead, use a temporary walk file that will not be reused.
733
808
  force_acquire_estop: whether to force acquire E-stop from the previous client.
734
809
  skip_initialization: whether to skip initialization when starting the return to dock mission.
810
+ walk: the walk to dispatch the robot to. If this is set, mission_uuid should be None.
735
811
  kwargs(**): a variable number of keyword arguments for the post request.
736
812
  Raises:
813
+ ValueError: if neither or both of mission_uuid and walk are set.
814
+ AssertionError: if delete_mission is set to True.
737
815
  RequestExceptions: exceptions thrown by the Requests library.
738
816
  UnauthenticatedClientError: indicates that the client is not authenticated properly.
739
817
  Returns:
740
818
  requests.Response: The response associated with the post request.
741
819
  """
742
820
  # Payload required for dispatching a mission
821
+ if (mission_uuid is not None and walk is not None) or (mission_uuid is None and
822
+ walk is None):
823
+ raise ValueError(
824
+ "Exactly one of mission_uuid or walk must be set (not both or neither).")
825
+
826
+ if delete_mission:
827
+ raise AssertionError(
828
+ "'delete_mission' is deprecated and no longer supported. "
829
+ "Instead, pass in a 'walk' object that only temporarily exists and will not be reused."
830
+ )
831
+
832
+ dispatch_target = {}
833
+ if mission_uuid is not None:
834
+ warnings.warn(
835
+ "'mission_uuid' is deprecated and will be removed in a future release. "
836
+ "Please use 'walk' instead.", DeprecationWarning, stacklevel=2)
837
+ dispatch_target["missionId"] = mission_uuid
838
+ if walk is not None:
839
+ dispatch_target["walk"] = walk
840
+
743
841
  payload = {
744
842
  "agent": {
745
843
  "nickname": robot_nickname
@@ -757,15 +855,14 @@ class Client():
757
855
  }
758
856
  },
759
857
  "task": {
760
- "missionId": mission_uuid,
858
+ "dispatchTarget": dispatch_target,
761
859
  "forceAcquireEstop": force_acquire_estop,
762
- "deleteMission": delete_mission,
763
860
  "requireDocked": False,
764
861
  "skipInitialization": skip_initialization
765
862
  },
766
863
  "eventMetadata": {
767
- "name": "API Triggered Mission"
768
- }
864
+ "name": f"Driver Triggered Mission ({driver_id})"
865
+ },
769
866
  }
770
867
  return self.post_resource(
771
868
  f'calendar/mission/dispatch/{robot_nickname}?currentDriverId={driver_id}', json=payload,
@@ -789,7 +886,7 @@ class Client():
789
886
  "includeMissions": include_missions,
790
887
  "includeCaptures": include_captures,
791
888
  }
792
- return self.post_resource(f'backup_tasks/', json=payload, **kwargs)
889
+ return self.post_resource('backup_tasks/', json=payload, **kwargs)
793
890
 
794
891
  def patch_bulk_close_anomalies(self, element_ids: list[str], **kwargs) -> requests.Response:
795
892
  """ Bulk close Anomalies by Element ID.
@@ -912,8 +1009,14 @@ def create_client(options: 'argparse.Namespace') -> 'bosdyn.orbit.client.Client'
912
1009
  .format(options.verify))
913
1010
  verify = options.verify
914
1011
 
1012
+ # Sanitize the format of the cert option. Requests handles None, a single pathname,
1013
+ # or a sequence of pathnames with two or more elements.
1014
+ cert = options.cert
1015
+ if isinstance(cert, (list, tuple)) and len(cert) == 1:
1016
+ cert = cert[0]
1017
+
915
1018
  # A client object represents a single instance.
916
- client = Client(hostname=options.hostname, verify=verify, cert=options.cert)
1019
+ client = Client(hostname=options.hostname, verify=verify, cert=cert)
917
1020
 
918
1021
  # The client needs to be authenticated before using its functions
919
1022
  client.authenticate_with_api_token()
bosdyn/orbit/utils.py CHANGED
@@ -36,6 +36,29 @@ def get_api_token() -> str:
36
36
  return api_token
37
37
 
38
38
 
39
+ def add_base_arguments(parser):
40
+ """ Adds the most common arguments to the parser
41
+
42
+ This includes the hostname, verify, and cert arguments.
43
+
44
+ Args:
45
+ parser: the argument parser
46
+ """
47
+ parser.add_argument('--hostname', help='IP address associated with the Orbit instance',
48
+ required=True, type=str)
49
+ parser.add_argument(
50
+ '--verify',
51
+ help=
52
+ "verify(path to a CA bundle or Boolean): controls whether we verify the server's TLS certificate",
53
+ default=True,
54
+ )
55
+ parser.add_argument(
56
+ '--cert', help=
57
+ "a client certificate file for authentication (a .pem file containing the certificate and "
58
+ "key pair, or two separate files containing the certificate and key respectively and in "
59
+ "that order)", nargs='+', default=None)
60
+
61
+
39
62
  def get_latest_created_at_for_run_events(client: 'bosdyn.orbit.client.Client',
40
63
  params: Dict = {}) -> datetime.datetime:
41
64
  """ Given a dictionary of query params, returns the max created at time for run events
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: bosdyn-orbit
3
- Version: 4.1.1
3
+ Version: 5.0.1
4
4
  Summary: Boston Dynamics API Orbit Client
5
5
  Home-page: https://dev.bostondynamics.com/docs/orbit/
6
6
  Author: Boston Dynamics
@@ -0,0 +1,9 @@
1
+ bosdyn/__init__.py,sha256=CMQioQKK1NlMk3kZuY49b_Aw-JyvDeOtuqOCAul1I0s,330
2
+ bosdyn/orbit/__init__.py,sha256=L_VSEXjtWZNHVHs3Jdr_TF2pJ2ju2yysAi0-YZsbJoU,266
3
+ bosdyn/orbit/client.py,sha256=GQc2J79FTjAZPsHT3yZZOHs3NoEgpw5tOcvNiPJt2fc,50308
4
+ bosdyn/orbit/exceptions.py,sha256=eaeHSlGh27JlZUEjcpLKxR1CNdW6Twp4e685pUgEjyQ,711
5
+ bosdyn/orbit/utils.py,sha256=n6tQFcII6JJ5aQt7lzNvXnLKM_Oc7l7VZT7gZp6CM1k,15178
6
+ bosdyn_orbit-5.0.1.dist-info/METADATA,sha256=nyNfMzItOUnm77ZTNFkrIuaoTMwYVctnJpS-5h7fZjc,1894
7
+ bosdyn_orbit-5.0.1.dist-info/WHEEL,sha256=AtBG6SXL3KF_v0NxLf0ehyVOh0cold-JbJYXNGorC6Q,92
8
+ bosdyn_orbit-5.0.1.dist-info/top_level.txt,sha256=an2OWgx1ej2jFjmBjPWNQ68ZglvUfKhmXWW-WhTtDmA,7
9
+ bosdyn_orbit-5.0.1.dist-info/RECORD,,
@@ -1,9 +0,0 @@
1
- bosdyn/__init__.py,sha256=CMQioQKK1NlMk3kZuY49b_Aw-JyvDeOtuqOCAul1I0s,330
2
- bosdyn/orbit/__init__.py,sha256=L_VSEXjtWZNHVHs3Jdr_TF2pJ2ju2yysAi0-YZsbJoU,266
3
- bosdyn/orbit/client.py,sha256=aoAlBKjygn2x9rXySjQzTxtWz7CcHkv6FqjMf8jhv5I,45471
4
- bosdyn/orbit/exceptions.py,sha256=eaeHSlGh27JlZUEjcpLKxR1CNdW6Twp4e685pUgEjyQ,711
5
- bosdyn/orbit/utils.py,sha256=Vhgdxa9dVjua2LteszF3rgsoKcF7Sb0c5AqsArtYRWk,14333
6
- bosdyn_orbit-4.1.1.dist-info/METADATA,sha256=G3qHTd_8jxL8VAuhyZFwqEMGPAbeFz37WhU62jwErlw,1894
7
- bosdyn_orbit-4.1.1.dist-info/WHEEL,sha256=AtBG6SXL3KF_v0NxLf0ehyVOh0cold-JbJYXNGorC6Q,92
8
- bosdyn_orbit-4.1.1.dist-info/top_level.txt,sha256=an2OWgx1ej2jFjmBjPWNQ68ZglvUfKhmXWW-WhTtDmA,7
9
- bosdyn_orbit-4.1.1.dist-info/RECORD,,