Skip to content

Commit 091256b

Browse files
committed
Add channel_defaults to the BaseApiClient example
Signed-off-by: Leandro Lucarella <[email protected]>
1 parent 035a794 commit 091256b

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/frequenz/client/base/client.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,18 @@ class ExampleResponseWrapper:
9191
def __init__(self, response: ExampleResponse) -> None:
9292
self.transformed_value = f"{response.float_value:.2f}"
9393
94+
# Change defaults as needed
95+
DEFAULT_CHANNEL_OPTIONS = ChannelOptions()
96+
9497
class MyApiClient(BaseApiClient):
95-
def __init__(self, server_url: str, *, connect: bool = True) -> None:
96-
super().__init__(server_url, connect=connect)
98+
def __init__(
99+
self,
100+
server_url: str,
101+
*,
102+
connect: bool = True,
103+
channel_defaults: ChannelOptions = DEFAULT_CHANNEL_OPTIONS,
104+
) -> None:
105+
super().__init__(server_url, connect=connect, channel_defaults=channel_defaults)
97106
self._stub = cast(
98107
ExampleAsyncStub, ExampleStub(self.channel)
99108
)

0 commit comments

Comments
 (0)