title: Python httplib.HTTPSConnection timeout -- connection vs. response
body: <p>When creating an <code>HTTPSConnection</code> with <code>httplib</code>, easy enough to set a timeout:</p>
  
  <pre><code>connection = httplib.HTTPSConnection('some.server.com', timeout=10)
  connection.request('POST', '/api', xml, headers={'Content-Type': 'text/xml'})
  response = connection.getresponse().read()
  </code></pre>
  
  <p>There are various parts to this operation, e.g. the connection being accepted and a response being received.</p>
  
  <p>Does the timeout apply to the entire operation? Will it still timeout if the remote host accepts the connection but never sends back a response? I want to be sure that setting the timeout ensure that the operation blocks for a maximum of 10 seconds.</p>
  
  <p>Some context:</p>
  
  <p>I am connecting to an external API and want the operation to block. Just not for more than 10 seconds, and if it is blocking for more than 10 seconds, stop blocking and raise an exception. I'm correctly handling the case when an external API is unreachable, but unsure about when it accepts my connection but fails to respond.</p>