title: How to perform time limited response download with python requests?
body: <p>When downloading a large file with python, I want to put a time limit not only for the connection process, but also for the download.</p>
  
  <p>I am trying with the following python code:</p>
  
  <pre><code>import requests
  
  r = requests.get('http://ipv4.download.thinkbroadband.com/1GB.zip', timeout = 0.5, prefetch = False)
  
  print r.headers['content-length']
  
  print len(r.raw.read())
  </code></pre>
  
  <p>This does not work (the download is not time limited), as correctly noted in the docs: <a href="https://requests.readthedocs.org/en/latest/user/quickstart/#timeouts" rel="noreferrer">https://requests.readthedocs.org/en/latest/user/quickstart/#timeouts</a></p>
  
  <p>This would be great if it was possible:</p>
  
  <pre><code>r.raw.read(timeout = 10)
  </code></pre>
  
  <p>The question is, how to put a time limit to the download?</p>