requests.{get,post} timeout

Chris Angelico rosuav at gmail.com
Tue Aug 22 14:44:49 EDT 2017


On Wed, Aug 23, 2017 at 4:31 AM, Grant Edwards
<grant.b.edwards at gmail.com> wrote:
> On 2017-08-22, Chris Angelico <rosuav at gmail.com> wrote:
>
>> """
>> Once your client has connected to the server and sent the HTTP
>> request, the read timeout is the number of seconds the client will
>> wait for the server to send a response. (Specifically, it's the number
>> of seconds that the client will wait between bytes sent from the
>> server. In 99.9% of cases, this is the time before the server sends
>> the first byte).
>> """
>>
>> "Between bytes" implies that you could have a long request, as long as
>> there's a keep-alive transmission every few seconds.
>
> Except a keep-alive transmission doesn't contain any bytes, so it
> shouldn't reset the timer.

If it's a TCP keep-alive, yes. But if you're looking at a long-poll
HTTP server, or a websocket, or you're proxying a different type of
connection, you can use a connection-level keep-alive to reset it.
I've often worked with TELNET, using an IAC GA or similar as a
keep-alive to get past stupid routers that drop connections after five
minutes of idleness..

ChrisA



More information about the Python-list mailing list