Requests: "requests.Session" should allow "timeout" attribute

Created on 31 Aug 2013  路  2Comments  路  Source: psf/requests

Currently, you can set stuff like headers, authentication, etc in a "requests.Session" instance, to be used as default values for requests under that session. I would like to set a default timeout for the session too, to be used as the default timeout for requests under that session.

All 2 comments

A timeout attribute on a Session is not a logical thing. Consider that the Session can have cookies which are represented (when sent and received from the server) as headers as well as authentication which can happen on a Session. A timeout on a Session, however, would mean that after the value assigned to that attribute the Session would stop functioning. You instead want a timeout on a Request and there is no good way to specify that. This feature has been requested frequently before (see: #1130 for example) and we are not going to add it. Attributes should be logically associative.

Indeed, we used to have this functionality, but I removed it intentially.

Thanks for the suggestion, though! It does make a lot of sense.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ssbarnea picture ssbarnea  路  49Comments

botondus picture botondus  路  121Comments

philip-goh picture philip-goh  路  53Comments

digitaldavenyc picture digitaldavenyc  路  39Comments

pythonmobile picture pythonmobile  路  46Comments