title: Python requests, how to limit received size, transfer rate, and/or total time?
body: <p>My server does external requests and I'd like to limit the damage a failing request can do. I'm looking to cancel the request in these situations:</p>
  
  <ul>
  <li>the total time of the request is over a certain limit (even if data is still arriving)</li>
  <li>the total received size exceeds some limit (I need to cancel prior to accepting more data)</li>
  <li>the transfer speed drops below some level (though I can live without this one if a total time limit can be provided)</li>
  </ul>
  
  <p>Note I am not looking for the <code>timeout</code> parameter in requests, as this is a timeout only for inactivity. I'm unable to find anything to do with a total timeout, or a way to limit the total size. One example shows a <code>maxsize</code> parameter on <code>HTTPAdapter</code> but that is not documented.</p>
  
  <p>How can I achieve these requirements using <code>requests</code>?</p>