requests.{get,post} timeout

Jon Ribbens jon+usenet at unequivocal.eu
Tue Aug 22 15:06:04 EDT 2017


On 2017-08-22, Chris Angelico <rosuav at gmail.com> wrote:
> The low-level timeout will distinguish between those. If you want a
> high-level timeout across the entire job, you can do that too, but
> then you have to figure out exactly how long is "too long". Let's say
> you set a thirty-second timeout. Great! Now someone uses your program
> on a midrange connection to download a 100MB file, or on a poor
> connection to download a 5MB file, or on dial-up to download a 10KB
> file. Data is constantly flowing, but at some point, the connection
> just dies, because it's hit your timeout. This is EXTREMELY
> frustrating.

Sure, the right timeout to use depends on what your application is and
what it's doing.

> You can always add in the overall timeout separately. If the low-level
> timeout were implemented that way, there would be no way to externally
> add the other form of timeout. Therefore the only sane way to
> implement the request timeout is a between-byte limit.

I have no idea what you mean here. The only sane way to implement the
request timeout is to provide both types of timeout.



More information about the Python-list mailing list