How to not block making initial connection with python requests? <p>I have a server that uses requests to make queries to another server that may or may not be running. If that server is not running, I do not want to block for a long time; I can just handle the error right away. However, the timeout parameter does not seem to apply to the process of making the initial connection.</p> <p>From the terminal, I run:</p> <pre><code>&gt;&gt;&gt; import time &gt;&gt;&gt; import requests &gt;&gt;&gt; t1 = time.time() ; exec("try: requests.get('http://192.168.99.100/', timeout=1.0)\nexcept: pass") ; t2 = time.time() ; t2 - t1 21.00611114501953 </code></pre> <p>This takes about 21 seconds and has no dependance on the timeout I give. I also tried using eventlet's timeout, but it turned out the same:</p> <pre><code>&gt;&gt;&gt; import time &gt;&gt;&gt; import eventlet &gt;&gt;&gt; requests = eventlet.import_patched('requests') &gt;&gt;&gt; t1 = time.time() ; exec("try: \n with eventlet.Timeout(1): requests.get('http://192.168.99.100/')\nexcept: pass") ; t2 = time.time() ; t2 - t1 21.00276017189026 </code></pre> <p>The error I am getting for the connection is:</p> <pre><code>ConnectionError: ('Connection aborted.', error(11, 'Resource temporarily unavailable')) </code></pre> <p>Finally, I am running python under the Windows Subsystem for Linux, which might be working with sockets differently.</p>