You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Traceback (most recent call last):
File "..../requests/adapters.py", line 425, in send
timeout = TimeoutSauce(connect=connect, read=read)
File "..../urllib3/util/timeout.py", line 94, in __init__
self._connect = self._validate_timeout(connect, 'connect')
File "..../urllib3/util/timeout.py", line 121, in _validate_timeout
raise ValueError("Timeout cannot be a boolean value. It must "
ValueError: Timeout cannot be a boolean value. It must be an int, float or None.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "test.py", line 3, in <module>
get("https://random.org", timeout=(True, True))
File "..../requests/api.py", line 76, in get
return request('get', url, params=params, **kwargs)
File "..../requests/api.py", line 61, in request
return session.request(method=method, url=url, **kwargs)
File "..../requests/sessions.py", line 537, in request
resp = self.send(prep, **send_kwargs)
File "..../requests/sessions.py", line 650, in send
r = adapter.send(request, **kwargs)
File "..../requests/adapters.py", line 431, in send
raise ValueError(err)
ValueError: Invalid timeout (True, True). Pass a (connect, read) timeout tuple, or a single float to set both timeouts to the same value
The second outputs:
Traceback (most recent call last):
File "test.py", line 3, in <module>
get("https://random.org", timeout=True)
File "..../requests/api.py", line 76, in get
return request('get', url, params=params, **kwargs)
File "..../requests/api.py", line 61, in request
return session.request(method=method, url=url, **kwargs)
File "..../requests/sessions.py", line 537, in request
resp = self.send(prep, **send_kwargs)
File "..../requests/sessions.py", line 650, in send
r = adapter.send(request, **kwargs)
File "..../requests/adapters.py", line 435, in send
timeout = TimeoutSauce(connect=timeout, read=timeout)
File "..../urllib3/util/timeout.py", line 94, in __init__
self._connect = self._validate_timeout(connect, 'connect')
File "..../urllib3/util/timeout.py", line 121, in _validate_timeout
raise ValueError("Timeout cannot be a boolean value. It must "
ValueError: Timeout cannot be a boolean value. It must be an int, float or None.
Calling
requests.get(...., timeout=X)
with a bad value forX
causesurllib3
to throw an exception.If
X
is a tuple, thenrequests
raises its own exception too (good!).If not, then
requests
doesn't say that it got a bad timeout value.#5017 suggested a fix, but was closed
Expected Result
These two lines should both raise an exception in
requests
:Actual Result
The first line outputs:
The second outputs:
Reproduction Steps
System Information
The text was updated successfully, but these errors were encountered: