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
Please refer to our Stack Overflow tag for guidance. requests.get('http://www.google.co.in', timeout=0.001)
Using above on one server works fine but on another server where probably outside access is not allowed requests doesn't timeout the request and only fails after few seconds with below error.
Traceback (most recent call last):
File "/home/utrade/utradeENV/lib/python3.6/site-packages/urllib3/connection.py", line 141, in _new_conn
(self.host, self.port), self.timeout, **extra_kw)
File "/home/utrade/utradeENV/lib/python3.6/site-packages/urllib3/util/connection.py", line 60, in create_connection
for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
File "/home/utrade/python3.6_optimized/lib/python3.6/socket.py", line 743, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -2] Name or service not known
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/utrade/utradeENV/lib/python3.6/site-packages/urllib3/connectionpool.py", line 600, in urlopen
chunked=chunked)
File "/home/utrade/utradeENV/lib/python3.6/site-packages/urllib3/connectionpool.py", line 356, in _make_request
conn.request(method, url, **httplib_request_kw)
File "/home/utrade/python3.6_optimized/lib/python3.6/http/client.py", line 1239, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/home/utrade/python3.6_optimized/lib/python3.6/http/client.py", line 1285, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/home/utrade/python3.6_optimized/lib/python3.6/http/client.py", line 1234, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/home/utrade/python3.6_optimized/lib/python3.6/http/client.py", line 1026, in _send_output
self.send(msg)
File "/home/utrade/python3.6_optimized/lib/python3.6/http/client.py", line 964, in send
self.connect()
File "/home/utrade/utradeENV/lib/python3.6/site-packages/urllib3/connection.py", line 166, in connect
conn = self._new_conn()
File "/home/utrade/utradeENV/lib/python3.6/site-packages/urllib3/connection.py", line 150, in _new_conn
self, "Failed to establish a new connection: %s" % e)
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7f9342c32f98>: Failed to establish a new connection: [Errno -2] Name or service
not known
What am I doing wrong or how can I make it timeout?
The text was updated successfully, but these errors were encountered:
Please refer to our Stack Overflow tag for guidance.
requests.get('http://www.google.co.in', timeout=0.001)
Using above on one server works fine but on another server where probably outside access is not allowed requests doesn't timeout the request and only fails after few seconds with below error.
What am I doing wrong or how can I make it timeout?
The text was updated successfully, but these errors were encountered: