Closed hyxbiao closed 7 years ago
timeout is optional, the default value is None, means that it will block connection/read, it is the same as request/adapters.py:
def send(self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None):
if isinstance(timeout, tuple):
try:
connect, read = timeout
timeout = TimeoutSauce(connect=connect, read=read)
except ValueError as e:
# this may raise a string formatting error.
err = ("Invalid timeout {0}. Pass a (connect, read) "
"timeout tuple, or a single float to set "
"both timeouts to the same value".format(timeout))
raise ValueError(err)
else:
timeout = TimeoutSauce(connect=timeout, read=timeout)
it also can set timeout to socket._GLOBAL_DEFAULT_TIMEOUT
update information:
add timeout for _create_tunnel
funciton, almost forget it
move timeout to _h1/2_kwargs in hyper/common/connection.py
add more timeout tests
[+] Add connection/read timeout for requests adapter, we can use like this: