No, a timeout is set per created socket:
sock = socket.create_connection(
address=(self.host, self.port),
timeout=self.timeout,
)
This is all handled by urllib3
, the lower-level library used by requests
; see their API documentation:
timeout – Socket timeout in seconds for each individual connection. This can be a float or integer, which sets the timeout for the HTTP request, or an instance of
urllib3.util.Timeout
which gives you more fine-grained control over request timeouts. After the constructor has been parsed, this is always a urllib3.util.Timeout object.
requests
makes use of the util.Timeout
class for this to ensure both connecting and reading are subject to the timeout.