diff --git a/src/connectrpc/_client_async.py b/src/connectrpc/_client_async.py index 9de08d9..c44068c 100644 --- a/src/connectrpc/_client_async.py +++ b/src/connectrpc/_client_async.py @@ -101,6 +101,21 @@ def __init__( ) -> None: """Creates a new asynchronous Connect client. + When providing an HTTP client, for example to configure TLS settings, + it is the caller's responsibility to close it. + + Examples: + ```python + from pyqwest import Client + from my_service import MyServiceClient + + async with ( + Client() as http_client, + MyServiceClient("http://localhost:8000", http_client=http_client) as client, + ): + # Use the client! + ``` + Args: address: The address of the server to connect to, including scheme. codec: The [Codec][] to use for requests. If unset, defaults to binary protobuf. @@ -175,7 +190,7 @@ def __init__( self._execute_bidi_stream = execute_bidi_stream async def close(self) -> None: - """Close the HTTP client. After closing, the client cannot be used to make requests.""" + """Close the client. After closing, the client cannot be used to make requests.""" if not self._closed: self._closed = True diff --git a/src/connectrpc/_client_sync.py b/src/connectrpc/_client_sync.py index abdfe88..07e509e 100644 --- a/src/connectrpc/_client_sync.py +++ b/src/connectrpc/_client_sync.py @@ -94,6 +94,21 @@ def __init__( ) -> None: """Creates a new synchronous Connect client. + When providing an HTTP client, for example to configure TLS settings, + it is the caller's responsibility to close it. + + Examples: + ```python + from pyqwest import SyncClient + from my_service import MyServiceClientSync + + with ( + SyncClient() as http_client, + MyServiceClientSync("http://localhost:8000", http_client=http_client) as client, + ): + # Use the client! + ``` + Args: address: The address of the server to connect to, including scheme. codec: The [Codec][] to use for requests. If unset, defaults to binary protobuf. @@ -174,7 +189,7 @@ def __init__( self._execute_bidi_stream = execute_bidi_stream def close(self) -> None: - """Close the HTTP client. After closing, the client cannot be used to make requests.""" + """Close the client. After closing, the client cannot be used to make requests.""" if not self._closed: self._closed = True diff --git a/zensical.toml b/zensical.toml index a63142f..f07b2ed 100644 --- a/zensical.toml +++ b/zensical.toml @@ -36,7 +36,8 @@ alternate_style = true [project.plugins.mkdocstrings.handlers.python] inventories = [ "https://docs.python.org/3/objects.inv", - "https://protobufpy.com/objects.inv" + "https://protobufpy.com/objects.inv", + "https://pyqwest.dev/objects.inv", ] paths = ["src"]