Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Session level default timeout #2856

Closed
bodenr opened this issue Nov 3, 2015 · 1 comment
Closed

Session level default timeout #2856

bodenr opened this issue Nov 3, 2015 · 1 comment

Comments

@bodenr
Copy link

bodenr commented Nov 3, 2015

Best I can tell, today there is no way to set a default timeout at the Session level. That is, I want to create a session and give it a default timeout which should be used on any request() for the session if no timeout is given on the actual **kwargs of the request invocation.

Example:

session = requests.Session()
session.default_timeout = 9
...
# default timeout of 9 is used
session.get('http://thehost/good-stuff') 

# passed value of 3 is used
session.get('http://thehost/good-stuff', timeout=3)

This would be very helpful for consumers wanting to pool request sessions above the requests lib layer using common kwargs for all requests in the session(s).

@sigmavirus24
Copy link
Contributor

Hi @bodenr thanks for using requests and stopping by with this feature request.

The library strives to make very specific divides in what is appropriate to add where. Timeout values being specified on a session do not make very much sense to the project although it's plausible for you to add some code to do this (like pip) has.

In the future please search for closed and open issues discussing your topics. A quick search immediately brought up https://github.com/kennethreitz/requests/issues/2011 which was closed over a year ago. I'm sure there are others, but you can find them too with a quick search.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants