From 5bb38f9839d5b53d47273a903bf8a9ac8096bdfd Mon Sep 17 00:00:00 2001 From: Daniel Farley Date: Sun, 5 Jan 2020 10:47:17 -0800 Subject: [PATCH 1/2] Document None support for HTTPConnection.timeout `timeout` is passed down to `socket.settimeout()` which supports `None` and puts the socket in blocking mode. --- Doc/library/http.client.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Doc/library/http.client.rst b/Doc/library/http.client.rst index 807dd8bd379a08..bdfb57c7648910 100644 --- a/Doc/library/http.client.rst +++ b/Doc/library/http.client.rst @@ -40,11 +40,11 @@ The module provides the following classes: string if it has the form ``host:port``, else the default HTTP port (80) is used. If the optional *timeout* parameter is given, blocking operations (like connection attempts) will timeout after that many seconds - (if it is not given, the global default timeout setting is used). - The optional *source_address* parameter may be a tuple of a (host, port) - to use as the source address the HTTP connection is made from. - The optional *blocksize* parameter sets the buffer size in bytes for - sending a file-like message body. + If it is ``None`` then blocking operations will not timeout. If it is not given, + the global default timeout setting is used. The optional *source_address* + parameter may be a tuple of a (host, port) to use as the source address the + HTTP connection is made from. The optional *blocksize* parameter sets the buffer + size in bytes for sending a file-like message body. For example, the following calls all create instances that connect to the server at the same host and port:: From 1dc5a7f021dd98dbe1ba5d8b257e5c37d9efdffa Mon Sep 17 00:00:00 2001 From: Daniel Farley Date: Sat, 10 Dec 2022 13:20:11 -0800 Subject: [PATCH 2/2] Apply suggestions from code review Co-authored-by: Stanley <46876382+slateny@users.noreply.github.com> Co-authored-by: Jelle Zijlstra --- Doc/library/http.client.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/library/http.client.rst b/Doc/library/http.client.rst index 01f71b550d0d4c..cb7c6e2ebd8d81 100644 --- a/Doc/library/http.client.rst +++ b/Doc/library/http.client.rst @@ -39,8 +39,8 @@ The module provides the following classes: number. If no port number is passed, the port is extracted from the host string if it has the form ``host:port``, else the default HTTP port (80) is used. If the optional *timeout* parameter is given, blocking - operations (like connection attempts) will timeout after that many seconds - If it is ``None`` then blocking operations will not timeout. If it is not given, + operations (like connection attempts) will timeout after that many seconds. + If it is ``None`` then blocking operations will not time out. If it is not given, the global default timeout setting is used. The optional *source_address* parameter may be a tuple of a (host, port) to use as the source address the HTTP connection is made from. The optional *blocksize* parameter sets the buffer