From 305038a31dfcf249a9e89e70e3a96d5f5f3d1460 Mon Sep 17 00:00:00 2001 From: Salad Dais Date: Wed, 20 Dec 2023 00:58:12 +0000 Subject: [PATCH] Add HippoClient.main_caps_client convenience property --- client_examples/hello_client.py | 2 +- hippolyzer/lib/client/hippo_client.py | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/client_examples/hello_client.py b/client_examples/hello_client.py index 01b4401..732403d 100644 --- a/client_examples/hello_client.py +++ b/client_examples/hello_client.py @@ -34,7 +34,7 @@ async def amain(): client.session.message_handler.subscribe("ChatFromSimulator", _respond_to_chat) # Example of how to work with caps - async with client.main_region.caps_client.get("SimulatorFeatures") as features_resp: + async with client.main_caps_client.get("SimulatorFeatures") as features_resp: print("Features:", await features_resp.read_llsd()) while True: diff --git a/hippolyzer/lib/client/hippo_client.py b/hippolyzer/lib/client/hippo_client.py index 43e2c84..0321476 100644 --- a/hippolyzer/lib/client/hippo_client.py +++ b/hippolyzer/lib/client/hippo_client.py @@ -541,6 +541,12 @@ class HippoClient(BaseClientSessionManager): return None return self.main_region.circuit + @property + def main_caps_client(self) -> Optional[CapsClient]: + if not self.main_region: + return None + return self.main_region.caps_client + async def aclose(self): try: self.logout()