diff --git a/pyproject.toml b/pyproject.toml index 95c75fa..0167847 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -33,7 +33,7 @@ dependencies = [ "grpcio >= 1.54.2, < 2", "grpcio-tools >= 1.54.2, < 2", "protobuf >= 4.25.3, < 6", - "frequenz-client-base >= 0.6.0, < 0.7.0", + "frequenz-client-base >= 0.8.0, < 0.9.0", ] dynamic = ["version"] diff --git a/src/frequenz/client/reporting/_client.py b/src/frequenz/client/reporting/_client.py index d4dc68b..c66b395 100644 --- a/src/frequenz/client/reporting/_client.py +++ b/src/frequenz/client/reporting/_client.py @@ -28,6 +28,7 @@ from frequenz.api.reporting.v1.reporting_pb2 import TimeFilter as PBTimeFilter from frequenz.api.reporting.v1.reporting_pb2_grpc import ReportingStub from frequenz.client.base.client import BaseApiClient +from frequenz.client.base.exception import ClientNotConnected from frequenz.client.common.metric import Metric from google.protobuf.timestamp_pb2 import Timestamp as PBTimestamp @@ -151,6 +152,13 @@ def __init__(self, server_url: str, key: str | None = None) -> None: self._metadata = (("key", key),) if key else () + @property + def stub(self) -> ReportingStub: + """The gRPC stub for the API.""" + if self.channel is None or self._stub is None: + raise ClientNotConnected(server_url=self.server_url, operation="stub") + return self._stub + # pylint: disable=too-many-arguments async def list_single_component_data( self,