From bf88f29f3987b8d2acb8603a364da83229061995 Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Tue, 11 Aug 2020 16:51:39 +0100 Subject: [PATCH] Docs on local_address wildcards (#147) --- httpcore/_async/connection_pool.py | 6 +++++- httpcore/_sync/connection_pool.py | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/httpcore/_async/connection_pool.py b/httpcore/_async/connection_pool.py index a139feaa..9ce7ad43 100644 --- a/httpcore/_async/connection_pool.py +++ b/httpcore/_async/connection_pool.py @@ -77,7 +77,11 @@ class AsyncConnectionPool(AsyncHTTPTransport): * **keepalive_expiry** - `Optional[float]` - The maximum time to allow before closing a keep-alive connection. * **http2** - `bool` - Enable HTTP/2 support. - * **local_address** - `Optional[str]` - Local address to connect from. + * **local_address** - `Optional[str]` - Local address to connect from. Can + also be used to connect using a particular address family. Using + `local_address="0.0.0.0"` will connect using an `AF_INET` address (IPv4), + while using `local_address="::"` will connect using an `AF_INET6` address + (IPv6). """ def __init__( diff --git a/httpcore/_sync/connection_pool.py b/httpcore/_sync/connection_pool.py index dbfbf59b..7a1e8c93 100644 --- a/httpcore/_sync/connection_pool.py +++ b/httpcore/_sync/connection_pool.py @@ -77,7 +77,11 @@ class SyncConnectionPool(SyncHTTPTransport): * **keepalive_expiry** - `Optional[float]` - The maximum time to allow before closing a keep-alive connection. * **http2** - `bool` - Enable HTTP/2 support. - * **local_address** - `Optional[str]` - Local address to connect from. + * **local_address** - `Optional[str]` - Local address to connect from. Can + also be used to connect using a particular address family. Using + `local_address="0.0.0.0"` will connect using an `AF_INET` address (IPv4), + while using `local_address="::"` will connect using an `AF_INET6` address + (IPv6). """ def __init__(